Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

where and order - pagination order



2:06 pm on Jul 20, 2010 (gmt 0)

5+ Year Member


i'm trying to use the pagination script created by Stranger Studio [strangerstudios.com ].The script works fine for me but the major issue here i'm having the difficulty to get the highest click based on today date. What i want is today date ranging from the highest click to the lowest.

For eg

id| Date | Click
1. 20-07-2010 200
2. 20-07-2010 180
3. 20-07-2010 150

The mysql query were somehow doesn't blend it well with Stranger Studio script. The query worked fine if i don't used the pagination script.

Any idea how to query them in order here?

here's my problem of the code

$result = mysql_query("SELECT * FROM $tbl_name where date = '$time' ORDER BY hits $dir LIMIT $start, $limit");


2:14 pm on Jul 20, 2010 (gmt 0)

5+ Year Member

nevermind about it i've figured it out then. What i did is to use the ASC or DESC to get the right order that i wanted here

Thanks anyway :)


2:24 pm on Jul 20, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

Hi there Chrissim,

Not picking fault at all, but I thought it worth a mention. When using a mysql_query(); function and constructing a statement that contains concatenated vars in there, I would always construct the string outside of the function, and assign it to a var, just so that you can easily debug it should something go wrong.

For example:-

$SqlQuery = "SELECT * FROM `".$tbl_name."` WHERE `date` = '".$time."' ORDER BY `hits` ".$dir." LIMIT ".$start.", ".$limit." ";
$result = mysql_query($SqlQuery);

At least this way its easier to debug the string to screen.

Just thought I would mention that.



12:22 am on Jul 21, 2010 (gmt 0)

5+ Year Member

Thanks Matthew1980 for a piece of advise:)

Featured Threads

Hot Threads This Week

Hot Threads This Month