Francesc Francesc - 5 months ago 31
MySQL Question

jQuery Plugin to update live a <li> from PHP

is there any jQuery plugin to create something like the live feed from the Twitter Main Page , using PHP, which is getting the data from a MySQL database?

How has to be the PHP file?



You really don't need a plugin for this, you could easily create something similar yourself using jQuery to make AJAX calls to a PHP MySQL feed

Create a script to make reoccurring AJAX calls using setTimeout() and then add the new found results to the feed container using .prepend()



<script type="text/javascript" src=""></script>

#tweets {
    width: 500px;
    font-family: Helvetica, Arial, sans-serif;
#tweets li {
    background-color: #E5EECC;
    margin: 2px;
    list-style-type: none;
.author {
    font-weight: bold
.date {
    font-size: 10px;

jQuery(document).ready(function() {
    setInterval("showNewTweets()", 1000);

function showNewTweets() {
    $.getJSON("feed.php", null, function(data) {
        if (data != null) {
            $("#tweets").prepend($("<li><span class=\"author\">" + + "</span> " +  data.tweet + "<br /><span class=\"date\">" + + "</span></li>").fadeIn("slow"));


<ul id="tweets"></ul>



echo json_encode(array( "author" => "someone",
                        "tweet" => "The time is: " . time(), 
                        "date" => date('l jS \of F Y h:i:s A')));