| where and order - pagination order
|
chrissim

msg:4173345 | 2:06 pm on Jul 20, 2010 (gmt 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");
|
chrissim

msg:4173349 | 2:14 pm on Jul 20, 2010 (gmt 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 :)
|
Matthew1980

msg:4173357 | 2:24 pm on Jul 20, 2010 (gmt 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
|
chrissim

msg:4173735 | 12:22 am on Jul 21, 2010 (gmt 0) | Thanks Matthew1980 for a piece of advise:)
|
|
|