Jump to content

Recommended Posts

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 null

My 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 */
<?php

while($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...
Link to comment
https://forums.phpfreaks.com/topic/4300-displaying-results-from-mysql-date_format/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.