RE: [PHP-DB] Error prevention

From: Date: Tue, 13 Mar 2001 16:17:46 +0000
Subject: RE: [PHP-DB] Error prevention
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-7406@lists.php.net to get a copy of this message
Hi Martin, ... you forgot to 'mysql_fetch_row' or 'mysql_result'. Read about it in the PHP-Manual in the MySQL Functions. Greetinx, Mike Michael Rudel - Web-Development, Systemadministration - _______________________________________________________________ Suchtreffer AG Bleicherstraße 20 D-78467 Konstanz Germany fon: +49-(0)7531-89207-17 fax: +49-(0)7531-89207-13 e-mail: mailto:mru@suchtreffer.de internet: http://www.suchtreffer.de _______________________________________________________________ -----Original Message----- From: Martin Skjöldebrand [mailto:chimbis@skjoldebrand.org] Sent: Tuesday, March 13, 2001 5:05 PM To: php-db@lists.php.net Subject: [PHP-DB] Error prevention I'm baffled (again ....) In my mql database I'm doing: SELECT cl_login FROM client WHERE cl_login = "xxx"; and if "xxx" exists I get the result xxx while if it doesn't exist I get an empty string. In PHP I'm doing $querytest = "SELECT cl_login FROM client WHERE cl_login = '$txtLogin';"; $testresult = mysql_query($querytest, $mysql_link); if ($testresult) { print "Error: Client already in database."; exit; } Now, no matter what* I still get a result of the query: Resource id # 7 (i put in echo $testresult; when the routine didn't work). * That I get Resource id ... if I have a cl_login = xxx or if I don't have one. What's !¤#!"#¤ going? How do I check for a duplicate before writing it to the database? (Short of putting UNIQUE on the table, which I suppose would result in an error). -- 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 (#7406) next »