RE: [PHP-DB] Quarter question..
| From: | joakim dot andersson at cybercom dot se | Date: | Mon, 04 Nov 2002 14:56:03 +0000 |
| Subject: | RE: [PHP-DB] Quarter question.. | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-22968@lists.php.net to get a copy of this message | ||
> On Monday 04 November 2002 19:58, joakim.andersson@cybercom.se wrote:
> > > $sql = "select quarter($qdate)" or die("not work #3");
> >
> > change to
> > $sql = "select quarter($qdate) as my_quarter"; //Added an alias to
> > quarter($qdate). Easier to access that way...
> > And there's no need for an 'or die()' here. You're just assigning a
> > variable and most likely this will allways work!
>
> On the contrary. If you've made a mistake in your query you
> wouldn't know
> what's happening. So having the below is a very good idea.
>
> > $yyy = mysql_query ($sql) or die("not work #4: " . mysql_error());
> > //Standard MySQL trouble-shooting...
Hi Jason,
I might have been unclear in my reply.
The original code had an 'or die()' on $sql = "select..." aswell and that
is, in my opinion, rather unnecessary.
Using 'or die(mysql_error())' on mysql_query should be mandatory. At least
during development.
Regards
Joakim