I havent used mysql for a while... but here goes... http://www.mysql.com/doc/en/Date_and_time_functions.html
DATE_FORMAT(date,format) Formats the date value according to the format string. mysql> SELECT DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y'); -> 'Saturday October 1997' mysql> SELECT DATE_FORMAT('1997-10-04 22:23:00', '%H:%i:%s'); -> '22:23:00' it seems that DATE_FORMAT() is expecting a textual date as the first arguement. try this: $query = "SELECT username, password, DATE_FORMAT(CURRENT_TIMESTAMP(), '%d%m%y') FROM custlogon"; or if that doesnt work try: $query = "SELECT username, password, DATE_FORMAT(NOW(), '%d%m%y') FROM custlogon"; > -----Original Message----- > From: Dan J. Rychlik [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 24 September 2003 10:10 > To: Chris W. Parker; [EMAIL PROTECTED] > Subject: Re: [PHP] SQL statement > > > 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" <[EMAIL PROTECTED]> > To: "Dan J. Rychlik" <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > Sent: Tuesday, September 23, 2003 7:07 PM > Subject: RE: [PHP] SQL statement > > > > Dan J. Rychlik <mailto:[EMAIL PROTECTED]> > > 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 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > ************************************************************************************* This e-mail, including any attachments to it, may contain confidential and/or personal information. If you have received this e-mail in error, you must not copy, distribute, or disclose it, use or take any action based on the information contained within it. Please notify the sender immediately by return e-mail of the error and then delete the original e-mail. The information contained within this e-mail may be solely the opinion of the sender and may not necessarily reflect the position, beliefs or opinions of Salmat on any issue. This email has been swept for the presence of computer viruses known to Salmat's anti-virus systems. For more information, visit our website at www.salmat.com.au. ************************************************************************************* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php