Jump to content

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

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.