Im making a newsletter on my website in my school project.
It works fine, and emails will appear on my database when I type in. But I get an error:
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, object given in /customers/4/8/8/web-line.dk/httpd.www/TACO/forside.php on line 19
I can't figure out what it wants me to do.
My code:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$email="";
if (isset($_POST['signup-button'])){
include_once "Connect_db.php";
#$name=$_POST['name'];
$email=$_POST['signup-email'];
$sql=mysqli_query($mysqli,"SELECT*FROM newsletter WHERE
email='$email'");
$numRows=mysqli_num_rows($sql);
if(!$email){
echo "Udfyld email";
}
else if ($numRows > 0){
echo "Email allerede i system!";
}
else {
$sql_insert=mysqli_query($mysqli,"INSERT INTO newsletter (email,
dateTime)
VALUES ('$email', now())") or die (mysqli_error($mysqli));
}
}
?>