Having issues while trying to convert from mysql to mysqli.
I am getting this error
Fatal error: Call to undefined method mysqli_stmt::fetch_row()
This is the row it is referencing
while ($row = $stmt->fetch_row()) {
and here is the full code
if (!$include_base) {
$stmt = $mysqli->prepare("SELECT zip_code, lat, lon FROM zip_code WHERE zip_code <> ? AND WHERE lat BETWEEN ? AND ? AND lon BETWEEN ? AND ?");
$stmt->bind_param('iiiii', $zip, $min_lat, $max_lat, $min_lon, $max_lon);
$stmt->execute();
$stmt -> fetch();
}
else {
$stmt = $mysqli->prepare("SELECT zip_code, lat, lon FROM zip_code WHERE lat BETWEEN ? AND ? AND lon BETWEEN ? AND ?");
$stmt->bind_param('iiii', $min_lat, $max_lat, $min_lon, $max_lon);
$stmt->execute();
$stmt -> fetch();
}
if(!stmt) {
$this->last_error = mysql_error();
return false;
}
else {
while ($row = $stmt->fetch_row()) {
$dist = $this->calculate_mileage($details[0],$row[1],$details[1],$row[2]);
if ($this->units == _UNIT_KILOMETERS) $dist = $dist * _M2KM_FACTOR;
if ($dist <= $range) {
$return[str_pad($row[0], 5, "0", STR_PAD_LEFT)] = round($dist, $this->decimals);
}
}
}
It is while its in this code that it does not work, if I break it down to
query..
result..
while...
it does work
Can anyone help?