January 22nd, 2000, 02:39 AM
I need help in interfacing php with mysql.
I want to format a date using mysql's date_format function.
In telnet I typed the following and it works great:
select DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');
-> 'Saturday October 1997'
But in php3 I typed the following and it does not work:
$open_db = MYSQL_CONNECT("localhost","blablabla");
$date_action = select DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');
$date_name = MYSQL_QUERY($date_action,$open_db);
What is wrong with this code?
January 22nd, 2000, 07:22 AM
I'm not sure if it's a typo, but you don't have quotes around your assignment of $date_action:
$date_action = "select DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y')";
Also, after mysql_query(), $date_name would contain the result index, not the result. You still need to extract the data from the results. I.E.: