sql >> Base de Datos >  >> RDS >> Mysql

la información de sondeo largo de mysql no funciona

Cambie el código en su archivo poll.php a lo siguiente:

<?php
include 'db.php';
$old_msg_id = $_GET['old_msg_id']; 
$result = mysql_query("SELECT id FROM chatpoll ORDER BY id DESC LIMIT 1");
while($row = mysql_fetch_array($result))
{
    $last_msg_id = $row['id']; 
}
while($last_msg_id <= $old_msg_id)
{
    usleep(1000);
    clearstatcache();
    $result = mysql_query("SELECT id FROM chatpoll ORDER BY id DESC LIMIT 1");
    while($row = mysql_fetch_array($result))
    {
        $last_msg_id = $row['id'];
    }
}
$response = array();
$response['msg'] = 'new';
$response['old_msg_id'] = $last_msg_id;
echo json_encode($response);
?>