hello i want to creat script "most viewed" so i want to select most topic that have been wached between two dates for instance

from date 10,10,2012 to current date

i mean from 10 days ago untill current time

See BETWEEN and NOW() in the MySQL manual.

i have tried it but no date selected it is blank page,my date that i have stored it in database as this:18,10,2012"$today =gmdate("d,m,Y");"

<html>
<head><meta charset='utf-8'/></head>
<body>

<?php 

include "config.php";



$select=mysql_query("select * from topics where 
date BETWEEN DATE_SUB(NOW(),INTERVAL 10 Day) AND NOW()")or die(mysql_error());



while ($row=mysql_fetch_object($select)){
echo $row->topic_title;
echo "<br/>";
}


?>
</body>
</html>

IF you run that query in phpMyAdmin, do you get results?

no i do not get any result only blank page

The only reason I can think of is that you have no matching records. I tried the query, it works.

i do not understand what do you mean exactly but i want to remember you i have used this string to store date
$today =gmdate("d,m,Y");
does DATE_SUB accept date as i used in $today string

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.