php - select 2 specific row from last 8 row for different display -


i'm trying create main page recent posts (blog).

i want 2 recent ones use in different display [html & css] , other 6 in different them. in picture... http://i.imgur.com/t0imwxm.jpg

edit 1

// gets 2 recent posts [displayed in 2 big boxes]     function get_important_posts() {     global $dblink;     mysqli_set_charset($dblink, 'utf8');        // if () {             $result = mysqli_query($dblink ,"select *                                                                      `posts`                                                                      order `post_id`                                                                      desc limit 0,2") or die(mysqli_connect_error($dblink));             $rownumber = 0;             while ($row = mysqli_fetch_array($result) ) {                 if ($rownumber < 1) {                     echo  '<div class="bigbox right">                     <a href="post.php?id=' . $row['post_id'] .'">                     <div class="bigboximg"><img src="'. $row['bigthumb'] .'" width="390" alt="' . $row['title'] .'"></div></a>                     <a href="post.php?id=' . $row['post_id'] .'"><div class="bigboxtitle">' . $row['title'] . '</div></a>                     <div class="bigboxexcerpt">'. $row['excerpt'] . '</div>                     </div>';                     $rownumber++;                 } else {                     echo  '<div class="bigbox left">                     <a href="post.php?id=' . $row['post_id'] .'">                     <div class="bigboximg"><img src="'. $row['bigthumb'] .'" width="390" alt="' . $row['title'] .'"></div></a>                     <a href="post.php?id=' . $row['post_id'] .'">                     <div class="bigboxtitle">' . $row['title'] . '</div></a>                     <div class="bigboxexcerpt">'. $row['excerpt'] . '</div></div>';                     $rownumber++;                     }              }     } //}      // gets 5 recent posts after 2 recent posts     function get_posts() {     global $dblink;     mysqli_set_charset($dblink, 'utf8');     $result = mysqli_query($dblink ,"select *                                                               `posts`                                                               order `post_id`                                                               desc limit 2,5") or die(mysqli_connect_error($dblink));     while ($row = mysqli_fetch_array($result) ) {             echo  '<div class="box">             <a href="post.php?id=' . $row['post_id'] .'">             <div class="boximg"><img src="'. $row['smallthumb'] .'" width="130" alt="' . $row['title'] .'"></div></a>             <a href="post.php?id=' . $row['post_id'] .'">             <div class="boxtitle">' . $row['title'] . '</div></a>             <div class="boxexcerpt">'. $row['excerpt'] . '</div></div>';                    }     } 

$result = mysqli_query($dblink ,"select * `posts` order `post_id` desc limit 10"); $rownumber = 0; while ($row = mysqli_fetch_array($result) ) {    if($rownumber++ < 2){        echo "special row";    }    echo  '<a href="post.php?id=' . $row['post_id'] .'"><strong>' . $row['title'] . '</strong></a><br>'. $row['excerpt']; } 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -