0

Hello i need help my code and database is working 100% fine on localhost but when i upload website on hosting server php is not updating database. on localhost its working completely fine. my code support php version 5.6 so i have also updated php version 5.6 on cpanel but i dont know why its not work on hosting server. my code is below

<?php
ob_start();
 include("db_connection.php");



$sql="select distinct  userid ,  emailadress, Name ,allow from account where `allow` = 'y'   ";
$SQLRes=mysql_query($sql);
$s=0;

while($SQLRow=mysql_fetch_array($SQLRes)){
$s=$s+1;

$userID=$SQLRow["userid"];
$email=$SQLRow["emailadress"];
$nn=$SQLRow["Name"];

$tot=0;

$rr="converted to order";
$sr="";

$sqlo="select * from orders  where userID='".$userID."' and priceStatus='Receiveable' and orderType !='Quote'   ";
$SQLReo=mysql_query($sqlo);

while($SQLRo=mysql_fetch_array($SQLReo)){


$tot=$tot+$SQLRo["prices"];


}

$sqlt="insert into invtotal ( userName ,totalAmount , invStatus , userEmail , namee) values ('".$userID."'  , ".$tot." , 'Receiveable' , '".$email."' , '".$nn."') ";

echo $sqlt;

mysql_query($sqlt);

}





header("location:invoice.php");

ob_flush();
?>
4
  • Does this answer your question? PHP form : not updating mysql database Commented Feb 21, 2020 at 4:06
  • i have already checked that answer its not related my question. as mentioned my code is normal on localhost working fine everything when same code host on live server hosting its not updating database. if some thing is missing in hosting configuration so let me know or any php extension is missing related to this ? Commented Feb 21, 2020 at 4:13
  • Did you change the credentials of your db_connection.php credentials such that they are host specific to your web host. Some webhosting services such as siteground the use phpmyadmin may require that you specifically detail the host, user, password etc etc Commented Feb 21, 2020 at 6:02
  • Please stop using the mysql_ library... it's been deprecated for 7 years and insecure for a lot longer - either use mysqli_, or better yet, PDO and parameterised queries. Commented Feb 21, 2020 at 6:18

2 Answers 2

0

go to related table and check table structure and make id as auto increment/primary and try again , i also checked your code on server its working fine.

Sign up to request clarification or add additional context in comments.

Comments

0

Enable the ERROR Reporting in your file, So You will see the error. Write this line on start of file and check the errors

error_reporting(E_ALL);

If query is break than see the query manually on your mySQL DB and you will find whats wrong..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.