ScrewLooseSalad Posted July 11, 2013 Share Posted July 11, 2013 I've narrowed down my problem to this function... The page won't load, I suspected it was because it was stuck in a loop, but I couldn't see why, checking the error log confirmed this, as there were hundreds of errors for an undeclared variable.... I can't figure out why it is stuck in this loop, and I can't get the undeclared variable to go away, I even renamed it and it is still saying the old name of the variable is undeclared even though it isn't mentioned in the code anywhere I've renamed it.... Can anyone spot what is causing me grief? The only thing that would make sense would be if I wasn't updating the files when I uploaded them, but I am completely certain that I am... error log: [Thu Jul 11 10:39:54 2013] [error] [client 192.168.1.100] PHP Notice: Undefined variable: stocknow in /home/*****/stock/root/orderdel4/action.php on line 317, referer: http://stockmaster.local/orderdel4/editor.php?DeliverNote=D-270-2013 code: while ($i<=14) { if($replacement_company_PartNo[$i] = NULL) { //this isn't an item from the database, simply print the description $replacement_Description //write details to new delivery note via 'delnoteitems' $sql = "INSERT INTO `companyorders`.`delnoteitems`(`deliverNote`, `itemDesc`, `itemQuantity`, `itemNotes`, `company_PartNo`) VALUES ('$deliverNote', '$replacement_Part_Name[$i]', '$replacement_Quantity[$i]', '$replacement_Description[$i]', '$replacement_company_PartNo[$i]');" ; $result = mysql_query($sql); if(!$result) {echo "$sql<br>sql error! code: DL4-A031-$i. This isn't an item from the database, skipping write to 'fullnotestock'; however, 'delnoteitems' could not be written to. Round $i."; exit;} } else { //this is an item from the database, the stock listings must be updated as the item is listed onto the delivery note //write details to new delivery note via 'delnoteitems' $sql = "INSERT INTO `companyorders`.`delnoteitems`(`deliverNote`, `itemDesc`, `itemQuantity`, `itemNotes`, `company_PartNo`) VALUES ('$deliverNote', '$replacement_Part_Name[$i]', '$replacement_Quantity[$i]', '$replacement_Description[$i]', '$replacement_company_PartNo[$i]');" ; $result = mysql_query($sql); if(!$result) {echo "$sql<br>sql error! code: DL4-A032-$i. This is an item from the database, havent yet attempted to write to 'fullnotestock'; failed on 'delnoteitems' which could not be written to. Round $i."; exit;} //update the stock listing in 'fullstocklist' $sql = "UPDATE `fullstocklist` SET `Stock`='$stockfromdatabase[$i]' WHERE `company_PartNo`='$replacement_company_PartNo[$i]';" ; $result = mysql_query($sql); if(!$result) {echo "$sql<br>sql error! code: DL4-A033-$i. This is an item from the database, havent yet attempted to write to 'fullnotestock'; failed on 'delnoteitems' which could not be written to. Round $i."; exit;} } $i++; } Quote Link to comment Share on other sites More sharing options...
Solution ScrewLooseSalad Posted July 11, 2013 Author Solution Share Posted July 11, 2013 (edited) UPDATE ----------- Now every variable on every page of the site is an undefined variable :S this is a serious problem for me, as this app is currently being used... SECOND UPDATE ----------------------- Started working again, it seems the loop must have had an effect on the server.... I had to reboot the system Edited July 11, 2013 by ScrewLooseSalad Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted July 11, 2013 Share Posted July 11, 2013 the one = in your if() statement is assigning null to the variable, not testing if the variable is equal to a null. Quote Link to comment Share on other sites More sharing options...
ScrewLooseSalad Posted July 11, 2013 Author Share Posted July 11, 2013 the one = in your if() statement is assigning null to the variable, not testing if the variable is equal to a null. thankyou for pointing that out Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.