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.