skip to Main Content

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();
?>

2

Answers


  1. 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.

    Login or Signup to reply.
  2. 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..

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search