I am trying to display records from last one min onward but i keep getting the following error when running the script:
<error>Unknown column '$timeout' in 'where clause'</error>
The records in my db has date and time stamp using Now() function
date and time stamp format:2007-04-16 20:30:52
I be happy if some one show me how to fix this problem.Thanks
<error>Unknown column '$timeout' in 'where clause'</error>
The records in my db has date and time stamp using Now() function
date and time stamp format:2007-04-16 20:30:52
I be happy if some one show me how to fix this problem.Thanks
Code:
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
$server = "localhost"; // MySQL hostname
$username = "root"; // MySQL username
$password = "root"; // MySQL password
$dbname = "db"; // MySQL db name
$db = mysql_connect($server, $username, $password) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
// this is necessary, otherwise it won't work:
header('Content-type: application/xml');
// you need to return the error as xml as well
$timeout = time() - 60; // number of seconds to keep users in database
[b]$res = mysql_query('SELECT * FROM album where date > $timeout') or die('<error>'.mysql_error().'</error>'); [/b]
// display the root node of the xml, and start looping over the elements:
echo '<playlist>';
while($row = mysql_fetch_assoc($res)){
echo '<song>';
echo '<artist>'.$row['ip'].'</artist>';
echo '<name>'.$row['cmd'].'</name>';
echo '<image>'.$row['visitorStatus'].'</image>';
echo '<rating>'.$row['ids'].'</rating>';
echo '<songid>'.$row['date'].'</songid>';
echo '<totalvotes>'.$row['who_sessid'].'</totalvotes>';
echo '</song>';
}
echo '</playlist>';
?>