Re: MySQL substrings?
| From: | David Robley | Date: | Mon, 20 Aug 2001 01:43:09 +0000 |
| Subject: | Re: MySQL substrings? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-63438@lists.php.net to get a copy of this message | ||
On Mon, 20 Aug 2001 02:12, Chris Lambert wrote:
> It'd help if you have us the mysql_error() returned.
>
> Try the following:
>
> SELECT *, substring_date AS SUBSTRING(date,5,2) FROM $table ORDER BY
> substring_date
>
Date is a reserved word in Mysql. Also, that might work better, after
renaming the field from date, as
SELECT *, SUBSTRING(datefield,5,2) AS substring_date FROM $table ORDER BY
substring_date
>
> ----- Original Message -----
> From: Seb Frost <seb@raceshoot.com>
> To: Tom Carter <subs@roundcorners.com>; <php-general@lists.php.net>
> Sent: Sunday, August 19, 2001 11:19 AM
> Subject: RE: [PHP] MySQL substrings?
>
> | This doesn't work:
> |
> | $result = mysql_query("SELECT * FROM $table ORDER BY
> | SUBSTRING(date,5,2)")
> |
> | Any idea why?
> |
> | - seb
> |
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Oxymoron: Soviet Life.