Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case 'recebeMsg';
- $tempo_page = (isset($_SESSION['time_chat'])== true) ? $_SESSION['time_chat'] : date("Y-m-d H:i:s");
- $seleciona_msg = mysqli_query($conexao, "SELECT * from chat WHERE id_user != '$id' and id_lobby = '$id_lobby' and timestamp >= '$tempo_page' ORDER BY id ASC");
- if(mysqli_num_rows($seleciona_msg) > 0){
- $_SESSION['time_chat'] = date("Y-m-d H:i:s");
- $msgs = array('status' => 'success', 'msgs'=>mysqli_num_rows($seleciona_msg) );
- while($dados = mysqli_fetch_array($seleciona_msg)){
- $render = array(
- 'id_user'=>$dados['id_user'],
- 'contente'=>$dados['content'],
- 'time'=>$dados['time'],
- 'nick'=>$dados['nick']);
- array_push($msgs, $render);
- }
- echo json_encode($msgs, JSON_PRETTY_PRINT);
- }else{
- echo Erro('notnew');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement