TeddyKiller Posted April 13, 2010 Share Posted April 13, 2010 $getEvent_res = mysql_query("SELECT event_title, event_shortdesc, date_format(event_start, '%l:%i %p') as fmt_date, date_format(event_end, '%1:%1 %p') as end_date FROM calendar_events WHERE month(event_start) = '".$m."' AND dayofmonth(event_start) = '".$d."' AND year(event_start) = '".$y."' AND calendar = '1' ORDER BY event_start") or die(mysql_error()); Sorry it's a bit messy. The bit with the problem, is here. date_format(event_start, '%l:%i %p') as fmt_date, date_format(event_end, '%1:%1 %p') as end_date echoing fmt_date, works perfectly. Although echoing end_date doesn't work. Can you help? I know it's slightly SQL related.. but wasn't quite sure where i'd exactly put it as there could be a PHP solution. Cheers Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted April 13, 2010 Share Posted April 13, 2010 What types are event_start and event_end in the database? Quote Link to comment Share on other sites More sharing options...
Psycho Posted April 13, 2010 Share Posted April 13, 2010 I've not used date_format() in a database query before. but, I do notice that you are using it differently: date_format(event_start, '%l:%i %p') as fmt_date [uses the letter L and and the letter I] date_format(event_end, '%1:%1 %p') as end_date [uses the number 1 both times] Quote Link to comment Share on other sites More sharing options...
TeddyKiller Posted April 13, 2010 Author Share Posted April 13, 2010 Ah. that was the issue MJDamato. Cheers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.