RE: [PHP-DB] Nothing returned

From: Date: Sun, 04 Nov 2001 08:51:48 +0000
Subject: RE: [PHP-DB] Nothing returned
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-13986@lists.php.net to get a copy of this message
Assuming you can feed 'admin' into the function and it works, but feeding 'fred' doesn't, it looks like there is a problem with the data. Starting with the obvious that you have probably already covered 1. Is the data in the database at all - could there have been a problem inserting it? 2. Has it been entered correctly, not forgetting case sensitivity 3. Could there be any invisible chars (space or tab for example) in the data. I had a script that generated entries and I accidentally left a space at the beginning of the field. Took me hours to realise because it isn't immediately obvious! Worth a browse through with some sort of management tool, such as phpMyAdmin http://www.phpwizard.net/projects/phpMyAdmin/ if you haven't already. Not sure otherwise. HTH Peter > -----Original Message----- > From: Martin [mailto:chimbis@bahnhof.se] > Sent: 04 November 2001 06:03 > To: php-db@lists.php.net > Subject: RE: [PHP-DB] Nothing returned > > > Peter Lovatt wrote: > > > $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 > > echo $sql gives me: > SELECT * FROM users WHERE (name='admin') > when entering admin as user. So the name is passed to the > function but from > then on ... > > M. > > -- > 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 (#13986) next »