-Original Message-
From: Tyler Longren [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 18, 2001 1:25 PM
To: php-general
Subject: [PHP] sql query successful
I've been writing database enabled site for quite a while
now. One thing I have never figured out it how to determine
I believe you should use the error function for the database you're using to
check for failed queries. If you're using MySQL (which it appears that you
are), you would do something like this:
$sql = mysql_query(SELECT * FROM table ORDER BY rand());
if(mysql_error())
echo SQL not
Successful.
I know I could use mysql_affected_rows(), but why doesn't this work???
Tyler
- Original Message -
From: Mark Roedel [EMAIL PROTECTED]
To: Tyler Longren [EMAIL PROTECTED]; php-general
[EMAIL PROTECTED]
Sent: Wednesday, July 18, 2001 1:30 PM
Subject: RE: [PHP] sql query
Tyler Longren pressed the little lettered thingies in this order...
Hello everyone,
I've been writing database enabled site for quite a while now. One thing I
have never figured out it how to determine if a sql query is successful.
This works:
if ($connection =
-Original Message-
From: Christopher Ostmo [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 18, 2001 2:43 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] sql query successful
Your statement above is checking to see if the fact that $sql
is equal to mysql_query(SELECT * FROM table
Tyler Longren pressed the little lettered thingies in this order...
What about when DELETING from a table??? It always returns true.
Example...the highest ID in this table is 10:
?
if ($connection = mysql_connect(localhost,mysql,mysql)) {
print Connection established;
Mark Roedel pressed the little lettered thingies in this order...
-Original Message-
From: Christopher Ostmo [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 18, 2001 2:43 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] sql query successful
Your statement above is checking
-Original Message-
From: Tyler Longren [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 18, 2001 1:36 PM
To: Mark Roedel; php-general
Subject: Re: [PHP] sql query successful
What about when DELETING from a table??? It always returns true.
Example...the highest ID in this table
8 matches
Mail list logo