Jeremy Zawodny wrote:

Add error checking to all MySQL API calls and the problem will become
apparent. Right now you're assuming they all "just work" (except for
the mysql_connect()) but they probably don't.

I highly recommend anyone using MySQL use either AdoDB <http://php.weblogs.com/adodb> or write their own handler (wrapper) functions around the MySQL library calls. Most of my code uses something that looks like:

$Vehicles = db_get_vehicles($Params);
meta_show_vehicles($Vehicles, $Format);

... where db_get_vehicles might do something like:

if (!($Params = sql_check_params($Params))) return -1;
list ($rows, $error) = sql_do_query("SELECT ... FROM Vehicles LEFT JOIN ... WHERE $Params");
...
return $rows;

I worry about connecting, doing the actual query once connected and error checking in sql_do_query, so my main code looks clean(er).

--
Michael T. Babcock
C.T.O., FibreSpeed Ltd.
http://www.fibrespeed.net/~mbabcock



---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Reply via email to