Msg#: 4611887 posted 1:33 am on Sep 23, 2013 (gmt 0)
First post here!
I have a localhost site which has run perfectly well for a few years, then I updates my XAMMP to the new version and found out what mysqli was all about. I have been able to convert most of it back to a working interface, except one section. I have tried everything under the sun, but the problem persists.
Here is the error I'm getting:
Notice: Undefined variable: quan1 in C:\xampp\htdocs\addupc.php on line 39
The code above is not how you're going to find out.
mysqli's biggest improvement is the ability to use prepared statements and use them to separate data from code. That way you avoid sql injections. But the code above is still wide open to sql injection, XSS, and probably a lot more.
Also by now: <center>, <font> really ... it's just sad. Similarly <center><b>.... </center></b> isn't proper nesting And don't get me started on tables holding just one cell.
The "Notice" (not an error) you are getting is not because you are using mysqli. You probably had the same "problem" before, but the error_reporting level is probably set "higher" (by default) on the new server, so you are now seeing it.
The reason you are getting this "Notice" is because there are no rows returned in your result set and the $quan1 variable is not being explicitly set. (It will default to 0 in this case.)
Initialise your variables at the start of your code - always good practise.