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 executed successfully.";
else
        print "SQL executed successfully.";


Josh Hoover
KnowledgeStorm, Inc.
[EMAIL PROTECTED]

Searching for a new IT solution for your company? Need to improve your
product marketing? 
Visit KnowledgeStorm at www.knowledgestorm.com to learn how we can simplify
the process for you.
KnowledgeStorm - Your IT Search Starts Here 


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

Reply via email to