RE: [PHP] SQL statement
| From: | Chris W. Parker | Date: | Wed, 24 Sep 2003 00:07:27 +0000 |
| Subject: | RE: [PHP] SQL statement | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-163658@lists.php.net to get a copy of this message | ||
Dan J. Rychlik <mailto:drychlik@tcsconsult.com>
on Tuesday, September 23, 2003 4:58 PM said:
> I know its failing because php doesnt like the quotation before the
> format parameters. Ive tried to fix this without any luck. Any
> Ideas ?
It's failing because the ' before the %d is closing the string.
Here's how I work out SQL stuffs:
$sql = "SELECT username\n"
." , password\n"
." , DATE_FORMAT(timestamp, '%d%m%y')\n"
."FROM custlogon";
$query = ($sql);
Althought it looks like it takes a lot more time to write (which is
true) it looks great when you are debugging.
echo "<pre>$sql</pre>";
Alternatively you should be able to do this:
$query = ("SELECT username, password, DATE_FORMAT(timestamp, '%d%m%y')
FROM custlogon");
chris.