I am executing select query using mysqli ...
/** ------------ queries ---------- **/
$stmt = $mysqli->prepare("SELECT * FROM dept");
if(! $stmt)
{
echo "statement not prepared well";
}
else
{
echo $mysqli->error;
}
if (!$stmt->execute()) {
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
}
// add else
else{
echo "Query is successfully executed but no result fetch";
}
if (!($res = $stmt->get_result())) {
echo "Getting result set failed: (" . $stmt->errno . ") " . $stmt->error;
}
/** ------------------------------- **/
#------result ----
var_dump($res->fetch_all());
#---------(/result)----
My problem is the execute() is working fine but cannot fetch the records ... The table has good amount of data in it ... it is showing "Query is successfully executed but no result fetch" and after it Fatal error: Call to undefined method mysqli_stmt::get_result()
What am I doing wrong .. ?