Welcome to WebmasterWorld Guest from 54.196.244.206

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

where and order - pagination order

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

Junior Member

5+ Year Member

joined:July 24, 2009
posts: 113
votes: 0


hi

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 July 20, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:July 24, 2009
posts:113
votes: 0


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 July 20, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Feb 22, 2009
posts:1396
votes: 0


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.

Cheers,
MRb
12:22 am on July 21, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:July 24, 2009
posts:113
votes: 0


Thanks Matthew1980 for a piece of advise:)
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members