I want to create service which every second checking incoming orders in database and doing some stuff. Now I'm using php5.6 and mysql but I'm not sure this is good for that. Sorry for my code, but now I'm doing like this:
for ($x=0; $x < 999999999999; $x++)
{
$query1 = mysql_query("SELECT * FROM `orders`");
while ($row = mysql_fetch_assoc($query1)) {
//doing some stuff here
}
sleep(1);
}
It works about 12 hours and when crashing with error. Is there better solution for that or maybe is better to choose different language ?