Reloading page when new message received by the user not working.
I am developing a PHP chat application. Where admin and users can chat.
When new message arises, the user needs to reload the page and fetch the new message from the database.
My query is:-
$query = "SELECT * FROM `chat`
WHERE fromthe = '$email' and tothe='theadmin'
UNION ALL SELECT * FROM `chat`
WHERE fromthe = 'theadmin' and tothe='$email' order by id desc";
$sql1 = "UPDATE `chat` SET `status`='1' where tothe='$email'";
mysqli_query($con, $sql1);
Please help me to do it.
Thanks