I keep getting an error on line 20, "if(mysqli_num_rows != 0)"
. The error reads:
"Notice: Use of undefined constant mysqli_num_rows - assumed 'mysqli_num_rows' in C:\wamp\www\movieDB\movies.php on line 20"
It's probably just a stupid mistake that I'm overlooking, but I've tried just about everything I can figure. Thank you in advance!
enter code here
<?php
$mysqli = NEW MySQLi('localhost', 'root', '', 'movies');
$resultSet = ("SELECT * FROM movie");
function query ()
{
if(mysqli_num_rows != 0)
{
while ($rows = $resultSet->fetch_assoc())
{
$title = $rows['title'];
$date = $rows['releaseDate'];
$dFirst = $rows['directorFirst'];
$dLast = $rows['directorLast'];
echo "<p>Name: $title, $date<br>Director: $dFirst $dLast";
}
}else
{
echo "No results.";
}
}
?>
The HTML
<!DOCTYPE html>
<html>
<head>
<title>Movies</title>
<link rel="stylesheet" type="text/css" href="movies.css">
<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'>
<?php require("movies.php");?>
</head>
<body>
<h1>Hello World!!!</h1>
<a href="index.php">Home</a>
<div class="movies">
<div>
<?php
query();
?>
</div>
</div>
</body>
</html>