I'm currently working on a script. When a user posts something and the timedifference is smaller than 5 minutes, the user cannot post. If bigger than 5 minutes, he can make a post. I thaught this code would work, but I get a mysql_fetch_array error. What is wrong with my code?
if ($db_found)
{
$check="SELECT * DATEDIFF(MINUTE, send_time, CURRENT_TIMESTAMP) FROM bloopp WHERE email = '$email' ORDER BY id DESC LIMIT 1";
$res = mysql_query($check);
$data = mysql_fetch_array($res, MYSQLI_NUM);
if($data[0] < 5)
{
echo "You posted not so long ago.<br/>";
}
else
{
$sql="INSERT INTO bloopp (bloopp, browser, medium, send_time, email) VALUES ('$bloopp', '$browser', 'mobile', NOW(), '$email')";
$result = mysql_query($sql);
if($result)
{
header('Location: index.php');
}
else
{
echo "Something has gone wrong. We’re sorry.";
}
}
}
else
{
echo "ERROR";
}
mysql_close();
?>