How does MySQL press single-or dual-result classes?
This is a paging code, 10 records per page, sorted in reverse chronological order.
PHP Code
$sql = mysql_query ("SELECT * from article WHERE uid= ' 132828 ' ORDER by Date LIMIT".. ","); $num = 1;while ($row = m Ysql_fetch_array ($sql)) { if ($num ==1) { echo '
; } if ($num ==5) { echo '
; } How to write the code here, in order to press the single and class? if ($num%5==0) { echo '
; } $num + +;
}
Finally, I want the result of the output to be
HTML Code
HTML View
HTML Code
UL ul------------------------| 1st result | 2nd result |------------------------| 3rd result | 4th Result |------ ------ ------------| 5th Result | 6th Result | ------------ ------------| 7th Result | 8th Result | ------------ ------------| 9th Result | 10th result| ------------ ------------
------Solution--------------------
PHP code
$num = 1;while ($row = mysql_fetch_array ($sql)) {if ($nu M% 2) {$left [] = '
'. $row [' title ']. ' '; The Else $right [] = '
'. $row [' title ']. ' ';} echo "
". Implode ("", $left). ';
echo "
". Implode ("", $right). ';
------Solution--------------------
can also be done by moving the pointer
-