Jump to content

undefined variable - that isn't mentioned anywhere


Go to solution Solved by ScrewLooseSalad,

Recommended Posts

   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++;
  }
  • Solution

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 by ScrewLooseSalad
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.