Home > Article > Backend Development > mysql怎么按单双数结果并类
mysql如何按单双数结果并类?
这是一个分页的代码,每页十条记录,按时间倒序排列。
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$sql = mysql_query("SELECT * FROM article WHERE uid='132828' ORDER BY date LIMIT ".$number.",10 ");$num = 1;while($row = mysql_fetch_array($sql)){ if($num ==1){ echo '
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> ul ul ------------ ------------| 1st result | 2nd result | ------------ ------------| 3rd result | 4th result | ------------ ------------| 5th result | 6th result | ------------ ------------| 7th result | 8th result | ------------ ------------| 9th result | 10th result| ------------ ------------
$num = 1;while($row = mysql_fetch_array($sql)){ if($num % 2) { $left[] = '