fetching rows from mysql table and displaying them as JGROWL notifications
Posted
by jeansymolanza
on Stack Overflow
See other posts from Stack Overflow
or by jeansymolanza
Published on 2010-05-27T02:03:45Z
Indexed on
2010/05/27
2:11 UTC
Read the original article
Hit count: 367
hey guys,
i am having problems implementing my php/mysql code into a jgrowl
if you are familiar with jgrowl you will know it delivers notifications like Growl does for OS X
i am trying to get it read all the records from my table but at the moment it is only displaying one record as a notification and it loops through it 4 times
another problem is that if i have 5 rows in the table then jgrowl will only display 4 notifications are going to be viewed
how do i get it to view all the records in the table as notifications and how do i display the total number of records (5) as notifications and account for the missing one at the moment
thanking you guys in advance... God bless
<script type="text/javascript">
// In case you don't have firebug...
if (!window.console || !console.firebug) {
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {};
}
(function($){
$(document).ready(function(){
// This specifies how many messages can be pooled out at any given time.
// If there are more notifications raised then the pool, the others are
// placed into queue and rendered after the other have disapeared.
$.jGrowl.defaults.pool = 5;
var i = 1;
var y = 1;
setInterval( function() {
if ( i < <?php echo $totalRows_comment; ?> ) {
<?php
echo '$.jGrowl("'.$row_comment['comment'].'",';
?>
{
sticky: true,
log: function() {
console.log("Creating message " + i + "...");
},
beforeOpen: function() {
console.log("Rendering message " + y + "...");
y++;
}
});
}
i++;
} , 1000 );
});
})(jQuery);
</script>
<p>
</span>
<p>
© Stack Overflow or respective owner