Jump to content
MakeWebGames

Inventory Error


Recommended Posts

Anyways I can fix this error?

 

A non-critical error has occurred. Page execution will continue. Below are the details:
PHP Notice: Undefined variable: stat1 (8)

Line executed: /home/samurai/public_html/inventory.php:159

A non-critical error has occurred. Page execution will continue. Below are the details:
PHP Notice: Undefined variable: stat2 (8)

Line executed: /home/samurai/public_html/inventory.php:160

A non-critical error has occurred. Page execution will continue. Below are the details:
PHP Notice: Undefined variable: stat3 (8)

Line executed: /home/samurai/public_html/inventory.php:161

 

I tried everything and I couldn't be able to fix it...

 

Line 159 - 161

 

                       $stat1+=$i['inv_qty'];
		$stat2+=$i['itmsellprice'];
		$stat3+=$i['itmsellprice']*$i['inv_qty'];
Link to comment
Share on other sites

Without first understanding what those variables are used for, simply changing += to = would not be a good idea.

What you should've done *above* those three lines was add this:

$stat1 = 0;
$stat2 = 0;
$stat3 = 0;

 

What the code was doing is this: It was trying to add on to a non-set variable

Link to comment
Share on other sites

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.   Paste as plain text instead

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