Forum Moderators: coopster
$sql = mysql_query("SELECT id, colour FROM category_two");
(... some more stuff)
The question here is, what are the significant differences in building a query as given above and something like this?
$query = "SELECT cat_id,cat_name FROM category ORDER BY cat_name" ;
$result = mysql_query($query);
(... some more stuff)
The query in the first instance seems so much more efficient yet, the second method seems so commonplace. Emphasis here being on the query structure NOT the content part following the SELECT statement.
TIA
it makes it very simple to echo the exact query if need be for debugging. It also makes it more straight forward for me when I am building very large dynamic queries.
One thing at a time, no need to get everything done in one shot. ;)