Hey.
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/?

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

<?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

$(document).ready(function(){
	var count = 0;
	setInterval(function() {
	  $.post("count.php", { countOld: count },
	   function(data){
		 if(data == 0) {
			 // Either there are no rows or the count is equal
                       return;
		 } 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.. 
                        return;
		 }
	   });
	}, 15000); // Every 15 seconds...
});

Does that make sense?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.