On Thu, 19 Jul 2001 03:54, Tyler Longren wrote:
> 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
You might want to look into mysql_errno and mysql_error; also
mysql_affected_rows to give you feedback on INSERT, UPDATE and DELETE
operations
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Can I yell "movie" in a crowded firehouse?
--
PHP General 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]