Do you have a question? Post it now! No Registration Necessary. Now with pictures!
January 18, 2007, 2:33 pm
rate this thread
If I have
Then I'd like to check for errors on the first line, so I can catch the
error and handle it myself?
Like the delphi:
while( !$error && odbc_fetch_row($result) )
Re: error checking in php?
Take a look at PDO. It's the new PHP 5 way of accessing databases, using a
unified syntax for all database engines (no need to worry about
mysql_query vs pg_query vs odbc_exec!)
*And* it uses Exceptions which can be handled pretty much like you
$db = new PDO ($connection_string, $username, $password);
$result = $db->query($sql_query);
foreach ($result as $row)
/* Do something */
catch (Exception $e)
print "Something bad happened", $e, "\n";
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact