Hello Andy,

Wednesday, April 7, 2004, 4:09:59 AM, you wrote:

AB> is it better to give the mysql query string to a variable
AB> instead of directly doing it with mysql_query?

AB> i.e.
AB> $query="select * from table";//is this a better way?
AB> $query=mysql_query("select * from table");//or is this way 
AB> //better?
AB> mysql_query("select * from table");//not a good idea i dont think...

Most people here probably use some kind of database abstraction layer
already (ADOdb, a Pear lib, or a home-grown one, etc). While you are
not doing this at the moment, if you hold the query in a string before
passing to MySQL it means you could implement a database handler in
the future with minimal code changes and not have to re-do every
single query.

There are other benefits, but that one strikes me as the most
important at the moment.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to