Jump to content

[SOLVED] data convert?


dare87

Recommended Posts

This code is suppost to pull all the data from one date to another, the problem I am having is that the data is mis matching.

 

The date in the db is YYYY-MM-DD and my NOW() is not working. Please Help

 

<?php
// This will post the three most current news articles.

// Connect to the database.
require_once('../../uwmysql_connect.php');

$query = "SELECT title, picurl AS url, details, DATE_FORMAT(start_date, '%M %d, %Y') AS sdate, DATE_FORMAT(end_date, '%M %d, %Y') AS edate FROM mydata WHERE start_date >= NOW() and end_date <= NOW()";
$results = mysql_query($query);

if ($results)
{	
// Insert the results.
while ($row = mysql_fetch_array($results, MYSQL_ASSOC))
{
	echo '
	<div id="item"><img src="images/' . $row['url'] . '.jpg" alt="' . $row['title'] . '"></div>
	<br><br><br>
	<div class="title2">' . $row['title'] . '</div>
	<div class="datetitle">' . $row['sdate'] . ' - ' . $row['edate'] . '</div>
	<div class="details">' . $row['details'] . '</div>

		';
}

// Free up the resources.
mysql_free_result ($results);
}
else
echo 'There is nothing there!!!!';
?>

Link to comment
https://forums.phpfreaks.com/topic/105530-solved-data-convert/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.