I made a while loop in php:
<?php
include_once("connect.php");
$search=mysql_query("SELECT * from chat ORDER BY id DESC LIMIT 1");
$row=mysql_fetch_assoc($search);
$type=$row['type'];
$id=$row['id'];
while($type!='n'){
usleep(10000);
$search=mysql_query("SELECT * from chat ORDER BY id DESC LIMIT 1");
$row=mysql_fetch_assoc($search);
$type=$row['type'];
}
$run=mysql_query("UPDATE chat SET type='o' WHERE id=$id");
mysql_close($conn);
echo $row['message'] . "<br/>";
?>
It always runs to see if there are new entries in the database, but I dont know what to do to keep the server from overloading. I tried usleep but I don't think it's enough.
Also I am getting this error "Fatal error: Maximum execution time of 60 seconds exceeded" and I know I can change the number of repetitions in the .ini file but would that be wise? Will it have a really bad effect on the servers performance?