disclaimer: I don't know js.. yet. i am very close to completing a project and came across a bump where i could use some help.
I have this js function to reload, and i would like to perform a database query every time it reloads to check for new messages... is this possible?
Everytime the js reload's i want to run this on the server...Code:<script type="text/javascript"> setTimeout(function(){ location.href.reload(true); }, 50000); </script>
Code:<?php $query = "SELECT * FROM mail_box WHERE receiver_id='$user_id'"; $result = mysqli_query($dbc, $query); while($row = mysqli_fetch_array($result)){ if($row['message_read'] == '0'){ echo 'New message(s)'; } ?>



Reply With Quote

Bookmarks