I'd like someone to point me in the right direction.
Basically, my work website shows data from a MySQL db.
If a new line of data is added in the DB, the user has no way of knowing that it has gone in until they have refreshed. Now, its not often they refresh it.

I need a way of making the bar in the taskbar to flash (like msn convo's) or ANY other way of notifying when a new line of data is added.

There has to be a way?
Can anyone help/?

7 Years
Discussion Span
Last Post by thejimgaudet

Well, off the top of my head I would say that you write a small PHP file that will check the count of rows in the db, like this

let's call the following code count.php

    //CONNECT to your DB
    $sql = 'SELECT * FROM table;';
    $result = mysql_query($sql);
    if( !$result ) {
        // Kill SQL and return error
    } else {
        // We will be sending an Old Count via POST
        $numRows = mysql_num_rows($result);
        if( $numRows == $_POST['countOld'] ) {
            // No change
            echo '0';
        } else 
            echo $numRows;

now in your normal page you will be using jQuery to test this on an interval

	var count = 0;
	setInterval(function() {
	  $.post("count.php", { countOld: count },
		 if(data == 0) {
			 // Either there are no rows or the count is equal
		 } else {
			count = data; // This will change the count for each run, you could store this in div with .data() ...
			// Add your code here, make a field red or auto refresh page.. 
	}, 15000); // Every 15 seconds...

Does that make sense?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.