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:[EMAIL PROTECTED]
internet: http://www.suchtreffer.de
_______________________________________________________________
-----Original Message-----
From: Martin Skjöldebrand [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 13, 2001 5:05 PM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]