RE: [PHP] SQL statement
| From: | Jennifer Goodie | Date: | Wed, 24 Sep 2003 00:15:24 +0000 |
| Subject: | RE: [PHP] SQL statement | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-163661@lists.php.net to get a copy of this message | ||
> Ive used this
> $query = ("SELECT username, password, DATE_FORMAT(timestamp,
> '%d%m%y') FROM
> custlogon");
>
> But I recieve unknown index timestamp. *shrug*
>
>
You are receiving the error on an array returned by fetch_array? If so, it
is because the index is "DATE_FORMAT(timestamp, '%d%m%y')", not timestamp,
which isn't so great. You can see this by doing a print_r on the array to
see what is actually in it. Use aliasing in your query to give it a better
index.
"SELECT username, password, DATE_FORMAT(timestamp, '%d%m%y') as formatted_ts
FROM custlogon" or something like that.