Page 1 of 1

Undefined Variable?

PostPosted: 22. June 2011 12:43
by samik666
Hey,
I'm getting an 'Undefined variable' error when I use a SELECT statement, for example, but the statement is syntactically correct and it functions as it should, but first I have to scroll through lines and lines of errors that say roughly along these lines..

Notice: Undefined variable: multistmt_flag in C:\xampp\htdocs\SID\sid.php on line 55

Notice: Undefined variable: a in C:\xampp\htdocs\SID\sid.php on line 118

How may I remove this clutter, there is no real error, and the files I'm using came with the tutorial I got, so they're assumedly correct?

I hope I'm not wasting anyone's time, but I'm sure I shouldn't be getting these errors..

Sam.

Re: Undefined Variable?

PostPosted: 22. June 2011 13:22
by Altrea
samik666 wrote:Notice: Undefined variable: multistmt_flag in C:\xampp\htdocs\SID\sid.php on line 55

Notice: Undefined variable: a in C:\xampp\htdocs\SID\sid.php on line 118

How may I remove this clutter, there is no real error, and the files I'm using came with the tutorial I got, so they're assumedly correct?


It works because PHP tries to process your script anyways. Other programming languages are much more strict.

You can get rid of that by using empty() or isset()functions at that point.
I don't know your two sourcelines, so i can't give you a complete fix.

Re: Undefined Variable?

PostPosted: 22. June 2011 17:06
by JonB
Another solution might be to change your error reporting level.

http://php.net/manual/en/function.error-reporting.php

Those are 'notices' - not errors (and also warnings is to be considered) As you pointed out, the script works; warnings and notices can be suppressed for testing and learning environments like on localhost with XAMPP, but need to be 'repaired' (as Altrea's suggestions might do) for production (live) environments.

Good Luck

Re: Undefined Variable?

PostPosted: 16. July 2012 07:42
by Ben_Benyamin
hey GUY !
I know the solution . the problem is because of your SID version is older than the XAMPP that U are using .
I have found a new SID version in the following address ( SID 2.2 ) :

http://bw.org/ldcsql/SID-CRUD-2.2.0.zip

by Bill Weinman , the lynda.com teacher !

Re: Undefined Variable?

PostPosted: 01. February 2013 18:37
by baronsona
Ben_Benyamin wrote:hey GUY !
I know the solution . the problem is because of your SID version is older than the XAMPP that U are using .
I have found a new SID version in the following address ( SID 2.2 ) :

http://bw.org/ldcsql/SID-CRUD-2.2.0.zip

by Bill Weinman , the lynda.com teacher !



Thx Ben I got this and it fix the problem for me.