Page 1 of 1

DATE_format

Posted: Tue Mar 09, 2004 12:02 pm
by nads1982
I am using this so I can display a DATE type in a nice fashion.
I have the sql syntax working in mysql
However I am unsure how to retrieve it in php..
I have

Code: Select all

$SQL="SELECT DATE_FORMAT(dob,'%D %M %Y')from members WHERE idnum=$id";
$result=mysql_query($SQL,$dB);
$row=mysql_fetch_array($result);
$dob=rowї"dob"]

Posted: Wed Mar 10, 2004 5:22 am
by nads1982
anyone?
I dunno how to call the result...

Posted: Wed Mar 10, 2004 5:50 am
by patrikG
I've never used to DATE_FORMAT in a select statement, in inserts it makes sense, but why don't you just grab the content and let PHP do the formatting with [php_man]date[/php_man]?

Posted: Wed Mar 10, 2004 5:58 am
by nads1982
found the solution in another forum..
incase anyone is looking..

Code: Select all

$SQL="SELECT DATE_FORMAT(dob,'%D %M %Y') as dob from members WHERE idnum=$id";
$result=mysql_query($SQL,$dB);
$row = mysql_fetch_array($result);
$dob = $rowї"dob"];