'I made a simple chat box with php but the problem is i want to display my messages on the right and the other user messages on the left i made two while loops but they didn't work. My table is like this (Sender - reciever - msg) I want to display each message ordered by time and on different places right side and left side
if (isset($_POST['user_id'])){ $sender_id = $_POST['user_id']; $sql = "SELECT * FROM messages_sys WHERE send_id=$sender_id AND reciever_id=$uid"; $sql_query = mysqli_query($conn, $sql); print_r($sql_query);