Feckie
05-17-2009, 06:59 AM
Can anyone help me sort this out please
I want to pull all entries in the last 7 days
I have this so far
Database
film_info
Tables
films
-------------------------------------
Film_Id Title Info Download View Year Extras TIMESTAMP
Page
<?php
$con = mysql_connect("localhost","film_info","Hmmm");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("film_info", $con);
$result = mysql_query("SELECT * FROM `films` WHERE `TIMESTAMP` condition 'DATE_SUB( NOW(), INTERVAL 7 DAY'");
echo "<body bgcolor=\"black\" text=\"red\" link=\"fuchsia\" vlink=\"purple\" alink=\"fuchsia\">\n";
echo " <center>
<h1><b><font size=6 color=red>Last 7 Days</font></b></h1>
</center> <left>
<table border='0'>
<hr></left>" ;
$i = 0;
while($row = mysql_fetch_array($result))
{
$i++;
echo "</br>";
echo "<b><font size=5 color=fuchsia>{$row['Title']}</font></b>";
echo "</br>";
echo "</br>";
echo "<b><font color=red>Genre: </font></b><font color=fuchsia>{$row['Extras']}</font>";
echo "</br>";
echo "</br>";
echo "<b><font color=red>Plot: </font></b><font color=fuchsia>{$row['Info']}</font></b>";
echo "</br>";
echo "</br>";
echo "<a href=http://somewhere/filesarehere/{$row['Download']}>Download</a>";
echo " - - ";
echo "<a target='main' href='http://somewhere/filesarehere/{$row['View']}'>View</a>";
echo "</br>";
echo "</br>";
echo "<hr>";
}
?>
the page works when I use
$result = mysql_query("SELECT * FROM films WHERE year = 2007");
Anyone have any idea
FIXED
$result = mysql_query("SELECT * FROM `films` WHERE `TIMESTAMP` > DATE_SUB( NOW(), INTERVAL 7 DAY)");
I want to pull all entries in the last 7 days
I have this so far
Database
film_info
Tables
films
-------------------------------------
Film_Id Title Info Download View Year Extras TIMESTAMP
Page
<?php
$con = mysql_connect("localhost","film_info","Hmmm");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("film_info", $con);
$result = mysql_query("SELECT * FROM `films` WHERE `TIMESTAMP` condition 'DATE_SUB( NOW(), INTERVAL 7 DAY'");
echo "<body bgcolor=\"black\" text=\"red\" link=\"fuchsia\" vlink=\"purple\" alink=\"fuchsia\">\n";
echo " <center>
<h1><b><font size=6 color=red>Last 7 Days</font></b></h1>
</center> <left>
<table border='0'>
<hr></left>" ;
$i = 0;
while($row = mysql_fetch_array($result))
{
$i++;
echo "</br>";
echo "<b><font size=5 color=fuchsia>{$row['Title']}</font></b>";
echo "</br>";
echo "</br>";
echo "<b><font color=red>Genre: </font></b><font color=fuchsia>{$row['Extras']}</font>";
echo "</br>";
echo "</br>";
echo "<b><font color=red>Plot: </font></b><font color=fuchsia>{$row['Info']}</font></b>";
echo "</br>";
echo "</br>";
echo "<a href=http://somewhere/filesarehere/{$row['Download']}>Download</a>";
echo " - - ";
echo "<a target='main' href='http://somewhere/filesarehere/{$row['View']}'>View</a>";
echo "</br>";
echo "</br>";
echo "<hr>";
}
?>
the page works when I use
$result = mysql_query("SELECT * FROM films WHERE year = 2007");
Anyone have any idea
FIXED
$result = mysql_query("SELECT * FROM `films` WHERE `TIMESTAMP` > DATE_SUB( NOW(), INTERVAL 7 DAY)");