I was writing the following code:
$conn = new mysqli($server,$user,$pw,$db) or die ('Could not connect to DB'.mysqli_error());
$id = 12345;
$sql = 'select * from invTypes where typeId = ? and published = 1';
$stmt = $conn->prepare($sql);
$stmt->bind_param("i",$id);
$stmt->execute();
$res = $stmt->get_result();
$row = $res->fetch_assoc();
//process $row's data.
When running the query inside of mysql with an int instead of a question mark, it works. It seems that I am doing something wrong with the way I bind, and then fetch.
I was flipping through docs and it seems Im a bit confused as to how i should go forward with this error.
Edit: I read this in the docs.
$stmt = $mysqli->prepare("SELECT id, label FROM test WHERE id = 1");
$stmt->execute();
$res = $stmt->get_result();
$row = $res->fetch_assoc();
and applied it to above. Still. the error is: Fatal error: Call to undefined method mysqli_stmt::get_result()