Re: assign mysql query to a variable first or not
| From: | David Robley | Date: | Wed, 07 Apr 2004 12:02:25 +0000 |
| Subject: | Re: assign mysql query to a variable first or not | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-182610@lists.php.net to get a copy of this message | ||
aborka1@wmis.net (Andy B) wrote in
news:00a301c41c4d$cfe3f860$34c66dd8@andy:
> hi...
>
> is it better to give the mysql query string to a variable instead of
> directly doing it with mysql_query?
>
> i.e.
> $query="select * from table";//is this a better way?
> $query=mysql_query("select * from table");//or is this way
> //better?
> mysql_query("select * from table");//not a good idea i dont think...
It's useful for debugging - you can then just echo your query and in
conjunction with mysql_error() determine where problems lie.