I'm using the following code snippet to select number of rows from students table. But it shows the error "Fatal error: Call to a member function bind_param() on a non-object". In my table 'stacyear' is VARCHAR, and 'courseid' is TINY INT.
$stmt = $mysqli->prepare("SELECT count (*) FROM students WHERE stacyear = ? and courseid = ?");
$stmt->bind_param('si', $acyear, $courseid);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($utype);
$stmt->fetch();