RE: [PHP-DB] Error prevention

2001-03-13 Thread Michael Rudel

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
Bleicherstrae 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 Skjldebrand [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]




RE: [PHP-DB] Error prevention

2001-03-13 Thread Martin Skjöldebrand

Michael Rudel wrote:

 Hi Martin,
 
 ... you forgot to 'mysql_fetch_row' or 'mysql_result'. Read about it in
 the PHP-Manual in the MySQL Functions.

Thanks Mike (and everyone else who pointed this out),

Sometimes you're blind.
When you think you pass the "complete-and-utter-newbie" phase something 
happens that crushes your self confidence.

*sigh*

Martin S.

-- 
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]