How does MySQL press single-or dual-result and class

Source: Internet
Author: User
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

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.