I do sampling from a DB. The print mysql_num_rows($res); command print mysql_num_rows($res); says that the answer is 3 lines - as it should be. But in json only the very first one is output. What am I doing wrong?
$query = "SELECT * FROM dialog_".$_POST['login']."_".$_POST['who'].""; $res = mysql_query($query); print mysql_num_rows($res); while($row = mysql_fetch_array($res)) { $dialogs["id"] = $row['id']; $dialogs["from_login"] = $row['from_login']; $dialogs["message_enc_from_key"] = $row['message_enc_from_key']; $dialogs["who_login"] = $row['who_login']; $dialogs["message_enc_who_key"] = $row['message_enc_who_key']; $dialogs["date_time"] = $row['date_time']; } echo json_encode($dialogs);