I am in the middle of converting a program from the mysql library to mysqli.
Edit: Some more context
I have the following code calling a class
case "purchasing";
$tab = 'purchasing';
require $classes . 'purchasing.php';
$purchases = new Purchase_list($search_term, $scope);
require $templates . 'header.php';
require $templates . 'purchasing.php';
break;
The class that contains get_result below is Purchase_list Purchase list basically figures out what rows to retrieve from the database, runs a query and assigns the results to $this->result
That part is obviously working since I have a valid result. Then $templates . 'purchasing.php'; displays those results.
For trouble shooting purposes purchasing.php only contains
while ($row = $purchases->get_result()) {
}
I have a function inside a class that looks like this
function get_result() {
$results = mysqli_fetch_array($this->result);
if($results === FALSE) {
return false;
}else {
$results['OPENAMT'] = ($results['Puramt'] - $results['Recamt']);
return $results;
}
}
if I comment out the the $results['OPENAMT'] code everything works great, with that code not commented it times out the browser request. This code worked with the mysql extension instead of mysqli
Can anyone shed any light on whats actually going on here.
a var_dump on $results before trying to return gives
array(11) {
[0]=> string(5) "23074"
["Purno"]=> string(5) "23074"
[1]=> string(3) "AEC"
["Vendno"]=> string(3) "AEC"
[2]=> string(10) "11/28/2012"
["Purdate"]=> string(10) "11/28/2012"
[3]=> string(4) "0.00"
["Puramt"]=> string(4) "0.00"
[4]=> string(4) "0.00"
["Recamt"]=> string(4) "0.00"
["OPENAMT"]=> float(0)
}
$resultslook like?var_dump($results)mysqli_fetch_assoc()? If you're not referencing the results by a numeric index...["OPENAMT"]=> float(0)is in the array. Maybe the issue is somewhere else in your code? Like the part that tries to accessOPENAMTafter it returns.