PWD Posted March 7, 2006 Share Posted March 7, 2006 I must be missing something basic and I have had 2 hours of sleep the last two days trying to figure this DATE_FORMAT function out...My Table Structure:[b]Table:[/b] imp_dates[b]Field 1:[/b] date_date DATE not null[b]Field 2:[/b] date_info varchar 250 not nullMy basic query (which is an include since this information is accessed on more than a dozen pages):[code]<?php$connect = mysql_connect("localhost","User","Pass") or die("<h1>Invalid Username and/or Password</h1>");mysql_select_db("data") or die("<h1>Could Not Connect to Database</h1>");$query = "Select DATE_FORMAT('date_date','%b %d %Y') AS date_date,date_info from imp_dates ORDER BY date_date ASC";$result = mysql_query($query) or die(mysql_error()); ?>[/code]My static webpage:[code]/* html markup */<?phpwhile($row = mysql_fetch_assoc($result)) {extract($row); ?>/*Some html mark up*/<li><?php echo $date_date; ?></li><li><?php echo $date_info; ?></li><?php}?>[/code]The date doesn't display AT ALL, but the info. snippet does...I'm simply trying to display the date in a format that is easier to read than int'l date format using the DATE_FORMAT() function. Where am I going wrong?My gratitude ahead of time for helping me learn...again... Quote Link to comment https://forums.phpfreaks.com/topic/4300-displaying-results-from-mysql-date_format/ Share on other sites More sharing options...
DylanBlitz Posted March 7, 2006 Share Posted March 7, 2006 $query = "Select DATE_FORMAT(date_date,'%b %d %Y') AS date_date,date_info from imp_dates ORDER BY date_date ASC";No quotes in the field name :) Quote Link to comment https://forums.phpfreaks.com/topic/4300-displaying-results-from-mysql-date_format/#findComment-14955 Share on other sites More sharing options...
PWD Posted March 7, 2006 Author Share Posted March 7, 2006 DOH! Thank you for the second pair of eyes![!--sizeo:3--][span style=\"font-size:12pt;line-height:100%\"][!--/sizeo--][b]Can I express my gratitude enough?[/b][!--sizec--][/span][!--/sizec--]Works perfectly... Quote Link to comment https://forums.phpfreaks.com/topic/4300-displaying-results-from-mysql-date_format/#findComment-14958 Share on other sites More sharing options...
DylanBlitz Posted March 7, 2006 Share Posted March 7, 2006 not a problem, sometimes it just takes someone else to see it, happens to me all the time :) Quote Link to comment https://forums.phpfreaks.com/topic/4300-displaying-results-from-mysql-date_format/#findComment-14960 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.