我没看到ajax的最后一次调用

Im using ajax to print the dates from my database.

The problem is that i dont see the last tuple of my database. So if there is only one tuple in my database , I do not see even this (Because is the last).

Ajax

$(function update ()  {
      $.ajax({       
      type: "POST",
      url: '/includes/contenuto.php',                  //the script to call to get data  
      data:{action:"show"},   
      success: function(data)          //on recieve of reply
      { 
        $("#pinBoot").html(data);
      }


        }).then(function() {           // on completion, restart
       setTimeout(update, 5000);  // function refers to itself
    });
      });

PHP

<?php
include('../core.php');
$action=$_POST["action"];
if($action=="show"){
$sql = mysql_query("")  or die ("Nessun errore");

$array = mysql_fetch_row($sql); 
    while ($row = mysql_fetch_array($sql))
    {
        echo '
    <article class="white-panel">
        <h4><a href="#">'.$row ['titolo'].'</a></h4>
        <p>'.Markdown($row ['contenuto']).'</p>
      </article>
     ';
    }


}                   
?>

Thanks all.

You are loosing a row each time you call this function by calling $array = mysql_fetch_row($sql); before you start your while loop.

<?php
include('../core.php');
$action=$_POST["action"];
if($action=="show"){
    $sql = mysql_query("SELECT `id`, DATE_FORMAT(data,'%e %b %Y') AS 
                       `data`, AES_DECRYPT(unhex(contenuto),'PASSWORD') AS 'contenuto', 
                       `video`, aes_decrypt(unhex(titolo),'PASSWORD') AS 'titolo', 
                       `immagine` 
                       FROM `post` 
                       WHERE 1 
                       ORDER by id DESC")  or die ("Nessun errore");

    // READ AND IGNORE A ROW? WHY
    //$array = mysql_fetch_row($sql); 

    while ($row = mysql_fetch_array($sql))
    {
        echo '
        <article class="white-panel">
            <h4><a href="#">'.$row ['titolo'].'</a></h4>
            <p>'.Markdown($row ['contenuto']).'</p>
        </article>';
    }
}                   
?>