php - mysqli execute() executing successfully but is not fetching the records -
this question exact duplicate of:
- trouble mysqli 4 answers
i executing select query using mysqli ...
/** ------------ queries ---------- **/ $stmt = $mysqli->prepare("select * 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 executed 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 execute() working fine cannot fetch records ... table has amount of data in ... showing "query executed no result fetch" , after fatal error: call undefined method mysqli_stmt::get_result()
what doing wrong .. ?
break following
if (!($res = $stmt->get_result())) {
to
$res = $stmt->get_result(); if( !$res ) {
or rather to
$res = $stmt->get_result(); if( $res->num_rows == 0 ) {
the error(i didn't notice earlier) because
mysqli_stmt::get_result() available
mysqlnd
.
you need install/configure following guidelines here.
Comments
Post a Comment