Jump to content

PHP refresh chat board. with a db update check.


ScoreKeeper

Recommended Posts

Right I want to make a request to my db to check the no. of rows it has.

If it has changed, refresh the chat page.

else wait.

I have tried to check for last db update, that never worked as well.

Well here is my code.

 

//this is my refresh script below
$result = mysql_query("SELECT * FROM chatmessages");
$num_rows = mysql_num_rows($result);
echo "$num_rows Rows\n";

while(0){ 
$num_rows_temp = mysql_num_rows($result);
if ($num_rows  != $num_rows_temp){
	$$num_rows=$num_rows_temp;
	echo "<script>";
	echo "window.location.replace('chatlog.php')";
	echo "</script>";
}else{
sleep(2);
}
}

 

I assume $num_rows  != $num_rows_temp is wrong as  it does not seem to do anything. Any help would be welcome. thanks.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.