RE: [PHP-DB] Nothing returned

From: Date: Sun, 04 Nov 2001 01:49:17 +0000
Subject: RE: [PHP-DB] Nothing returned
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-13981@lists.php.net to get a copy of this message
$sql = "SELECT * FROM users WHERE (name='$name')" if you are not getting an error, it is usually worth echoing the query SQL echo $sql ; and perhaps trying it manually. Is it possible the quotes around the $name are giving SELECT * FROM users WHERE (name='$name') and not evaluating $name rather than SELECT * FROM users WHERE (name='fred') which you wanted Peter > > : Why am I not getting anything returned from this function? > : I have code doing a if user exists and b if user doesn't exist. I'm not > : getting any numRows result apparently. The query is OK and > returns 1 user > : for $name=admin. I'm not getting any errors from isError. > : > : Martin > : > : function exists($name) > : { > : > : $sql = "SELECT * FROM users WHERE (name='$name')"; > > How about > $name="admin" > > and > WHERE name=$name > > Tim Morris > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#13981) next »