Re: SQL statement

From: Date: Wed, 24 Sep 2003 00:10:29 +0000
Subject: Re: SQL statement
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-163659@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* ----- Original Message ----- From: "Chris W. Parker" <cparker@swatgear.com> To: "Dan J. Rychlik" <drychlik@tcsconsult.com>; <php-general@lists.php.net> Sent: Tuesday, September 23, 2003 7:07 PM Subject: RE: [PHP] SQL statement > 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. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#163659) next »