function sendMsg($old, $id, $msg) { $db = new DatabaseConnector(); $newData = $db->GetServerMessages(); if ($old != $newData) { //send a command; print_r($newData); $row = null; foreach ($newData as $n) { $row = $n; } print_r($row); print "<br>"; echo "id: " . $row['messageType'] . PHP_EOL; echo "data: " . $row['message'] . PHP_EOL; echo PHP_EOL; ob_flush(); flush(); } return $newData; }