Jump to content

undefined function "mysqli_stmt_get_result" on php 5.3


funbinod

Recommended Posts

There's a comment in the PHP manual page for the function.

Please note that this method requires the mysqlnd driver. Othervise you will get this error: Call to undefined method mysqli_stmt::get_result()

It might be that the server doesn't have the mysqlnd driver.

Link to comment
Share on other sites

I did not see mysqlnd available there. but I found an option to upgrade my php to 5.5 for public_http folder. when I did that it did not show the error but it did not return any result also....

Edited by funbinod
Link to comment
Share on other sites

You said you just changed your server's PHP version so some of the settings were probably altered.

 

Go activate error displaying on your page with PHP and see if any errors show up.

ini_set('display_errors', '1');error_reporting(E_ALL);
Link to comment
Share on other sites

ok! it displayed the msg now. it means there was some alteration on error msg setting????? did it happened because I changed the version of php????? but the msg it is displaying is the error is the same msg it was displaying before that is ---

undefined function mysqli_stmt_get_result

 

I checked the version and the mysqlnd driver in the php configuration and it said php is version 5.5.11 and mysqlnd driver is present...

Link to comment
Share on other sites

Is that the only error on your page?

First, check phpinfo to see if MySQLi is installed.

 

Post the part of your code that isn't working and a few of the surrounding lines.

 

If you get any error messages, copy and paste them here exactly as they are. There might be some context missing that makes it difficult to figure out exactly what the problem might be.

Link to comment
Share on other sites

yes! this is the only message on the page...

 

Fatal error: Call to undefined function mysqli_stmt_get_result() in /home..................../classFifo.php on line 8

 

and here is the code for classFifo.php

<?php$totqty = 0;$totamt = 0;$querysss = "SELECT qty, amt FROM fifo WHERE sid=? AND cid=$cid ORDER BY date DESC";$stmt = mysqli_prepare($connect, $querysss);if (mysqli_stmt_bind_param($stmt, 'i', $sid)){	mysqli_stmt_execute($stmt) or die("Error: " . mysqli_error($connect));	$result = mysqli_stmt_get_result($stmt);	while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {		if ( !is_null($row['qty']) ){			if ($row['qty']>0 && $row['qty']+$totqty > $cqty){				$diff = $cqty - $totqty;				$totqty = $cqty;				$totamt += $diff*$row['amt']/$row['qty'];			// now you must record the remain count = $row->remain-$diff			} else if ($row['qty']>0) {				$totqty += $row['qty'];				$totamt += $row['qty']*$row['amt']/$row['qty'];			// now you must record the remain=0			}		} else if ($row['qty']+$totqty > $cqty){			$diff = $cqty-$totqty;			$totqty = $cqty;			$totamt += $diff*$row['amt']/$row['qty'];		// now you must record the remain count = $row->qty-$diff		} else {			$totqty += $row['qty'];			$totamt += $row['amt'];		// now you must record the remain=0		}	}	if ($cqty != $totqty) {		echo "error: recorded totqty={$totqty} purchased is insufficient to match cqty={$cqty}";	}} else {	echo 'error: could not bind';}$totamtarr[ $sid ] = $totamt;$runSum = 0;foreach($totamtarr as $clamt) {	$runSum += $clamt;	$total[] = $runSum;}mysqli_stmt_close($stmt);?>
Edited by funbinod
Link to comment
Share on other sites

back with a self try. please suggest if it gives d exact result as the above code gives..

<?php$totqty = 0;$totamt = 0;$querysss = "SELECT qty, amt FROM fifo WHERE sid=$sid AND cid=$cid ORDER BY date DESC";if ($stmt = mysqli_prepare($connect, $querysss)) {//if (mysqli_stmt_bind_param($stmt, 'i', $sid)){	mysqli_stmt_execute($stmt) or die("Errorsssss: " . mysqli_error($connect));	mysqli_stmt_bind_result($stmt, $qty, $amt);	while (mysqli_stmt_fetch($stmt)) {		if ( !is_null($qty) ){			if ($qty>0 && $qty+$totqty > $cqty){				$diff = $cqty - $totqty;				$totqty = $cqty;				$totamt += $diff*$amt/$qty;			// now you must record the remain count = $row->remain-$diff			} else if ($qty>0) {				$totqty += $qty;				$totamt += $qty*$amt/$qty;			// now you must record the remain=0			}		} else if ($qty+$totqty > $cqty){			$diff = $cqty-$totqty;			$totqty = $cqty;			$totamt += $diff*$amt/$qty;		// now you must record the remain count = $row->qty-$diff		} else {			$totqty += $qty;			$totamt += $amt;		// now you must record the remain=0		}	}	if ($cqty != $totqty) {		echo "error: recorded totqty={$totqty} purchased is insufficient to match cqty={$cqty}";	}} else {	echo 'error: could not bind';}$totamtarr[ $sid ] = $totamt;$runSum = 0;foreach($totamtarr as $clamt) {	$runSum += $clamt;	$total[] = $runSum;}mysqli_stmt_close($stmt);?>

I changed the code by getting idea from <php.net/manual/en/mysqli-stmt.bind-result.php>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...