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

Recommended Answers

All 6 Replies

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");"

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


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/>";


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, learning, and sharing knowledge.