sql query successful
| From: | Tyler Longren | Date: | Wed, 18 Jul 2001 18:24:32 +0000 |
| Subject: | sql query successful | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-58494@lists.php.net to get a copy of this message | ||
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 = mysql_connect("host","username","password")) {
print "Successful connection":
}
else {
print "No connection";
}
But this won't work:
if ($sql = mysql_query("SELECT * FROM table ORDER BY rand()")) {
print "SQL executed successfully.";
}
else {
print "SQL not executed successfully.";
}
Can anyone tell me how I can tell if the SQL executed successfully? Is
there any method besides OR DIE?
Thanks,
Tyler