crobinson42
05-23-2010, 05:35 PM
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?
<script type="text/javascript">
setTimeout(function(){
location.href.reload(true);
}, 50000);
</script>
Everytime the js reload's i want to run this on the server...
<?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)';
}
?>
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?
<script type="text/javascript">
setTimeout(function(){
location.href.reload(true);
}, 50000);
</script>
Everytime the js reload's i want to run this on the server...
<?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)';
}
?>