i have a problem getting my Javascript function to call when my php comments timestamp is the same as NOW() time...
the page with this code is called onto another page via AJAX and refreshes every second
here is the Code:
$sql="SELECT * FROM users WHERE username='".$_GET['q']."'";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
$sql2="SELECT * FROM comments WHERE user='".$row['accessid']."'";
$result2 = mysql_query($sql2);
while($row2 = mysql_fetch_array($result2))
{
if($row2['timestamp'] == DATE('F j, Y H:i:s')) {
echo "<script>window.onload = function() { sendRequest('userRequest', '".$row2['sent_by']." sent you a message.'); }</script>";
}
echo $row2['comment']."<hr>".$row2['timestamp']."<br><br>";
}
}
?>
i want this code to display a message box when someone leaves a comment.
i set a comment in the future, so when the current time hits the same as the comment timestamp it should call the function but it doesn't...
can someone please help me.
thanks in advance.