samedi 1 octobre 2016

How to skip a row from sql?

hi novice to php and mysql.trying to find how to skip first or last value in a loop of my sql table in descending order?i want to display recently added rows first but not display the last added row.

<tr>
              <?php
                $page=$_GET['pages'];    /* created in index.php(pages.php?pages=m_$title) */
                $nage="z_".$page;
               $query="SELECT * FROM `$nage` ORDER BY a_id DESC LIMIT 0, 1" ;
                $run=mysqli_query($conn,$query);
                while($row=mysqli_fetch_array($run)){
                    $page_title=$row['title'];
                    $img_src=$row['img_src'];

                   // $page_desc=$row['story'];


                    echo  "<tr bgcolor='pink'>
                              <td style='width:40%'>
                                <div class='titleDivX'>
                                <img class='imgFrame'src='$img_src' alt='tasvir'/>
                                <h5> $page_title</h5>
                                </div>
                             </td>

                             <td bgcolor='yellow'>
                                 <div class='titleDivX'> </div>
                             </td>

                        </tr>";

                }
              ?>




Aucun commentaire:

Enregistrer un commentaire