RE: [PHP] Session migration problem...

From: Date: Tue, 21 Oct 2003 03:44:10 +0000
Subject: RE: [PHP] Session migration problem...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-166883@lists.php.net to get a copy of this message
--- Jake McHenry <linux@nittanytravel.com> wrote: > I took the single quotes off of the field name, uname, but still > getting the same error at the same line in the file... > > Any other suggestions? Sure. Let's look at your original code: $result = mysql_query("SELECT * FROM users WHERE uname = '".$_POST['username']."'"); So, rather than trying to glance at this and figure out what's wrong, I will instead suggest a debugging technique or two. 1. Put your query in a variable like $sql. This can simplify your statement: $result = mysql_query($sql); 2. Don't wait until you use $result to find out it's not a valid resource; test it immediately: if (!$result = mysql_query($sql)) 3. If it's not a valid resource, this conditional statement will be true. You can echo (or send to a log file) the output of mysql_error() to see what MySQL thinks the last error was (which will be the error generated by the query, in this case). Hope that helps. Chris ===== My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp

« previous php.general (#166883) next »