I'm trying to fetch the database with a prepared statement, but I get a "Call to a member function fetch_assoc() on a non-object " error.
What am I doing wrong?
Thanks for your help!!
$peopleID = $_GET['peopleID'];
$stmt = $link->prepare("SELECT * FROM people WHERE peopleID = ?");
$stmt->bind_param('i', $peopleID);
$result = $stmt->execute();
$stmt->store_result();
if ($stmt->num_rows >= "1") {
while($row = $result->fetch_assoc()) {
$firstname = $row ['firstname'];
$lastname = $row ['lastname'];
}
}