Fatal Error: Call to Undefined Function MySQLi_Result()

Fatal error: Call to undefined function mysqli_result()

Don't use this kind of code. It's highly inefficient. Use mysqli_fetch_assoc() instead:

while($row = mysqli_fetch_assoc($result)) {
$id = $row['ID'];
$name = $row['name'];
etc..
}

One SINGLE database operation, rather than the 3+ you're trying to do.

Call to undefined function mysqli_result()

As opposed to mysql_result(), there's no mysqli_result() function available in MySQLi.

Use mysqli_fetch_array() function to get the total number of rows. Your code should be like this:

$per_page = 6;
$pages_query = mysqli_query($conn, 'SELECT COUNT(id) FROM users');
$row = mysqli_fetch_array($pages_query);
$pages = ceil($row[0] / $per_page);

Fatal error: Uncaught Error: Call to undefined method mysqli_result::mysqli_fetch_array() in

From the (very helpful) PHP docs:

$DBConnect->query($sqlGetTop5) returns false if the query failed.
This means something is wrong with your query. Though I am no SQL expert GROUD BY ORDER BY looks a little weird to me.

Fatal error: Call to undefined method mysqli_result::format()

The problem is mysqli_query returns a mysqli_result which you need to read before using:

require_once 'config.php';

$checker = "SELECT StartTime, EndTime, Minutes FROM ap21_Teachers WHERE Mentor_Class = 'I2C'";

$result = mysqli_query($mysqli, $checker); //Execute query

if (!$result) { //Result may be false if there's an error
echo "Error getting result";
}
$row = mysqli_fetch_assoc($result); //Put first result in an array
if (!$row) { // $row will be false if there's no result
echo "No data found";
}

//Notice how the array entry keys match the columns in the query.
$starttime = new DateTime($row["StartTime"]);
$endtime = new DateTime($row["EndTime"]);
$minutes = $row["Minutes"];

while($starttime <= $endtime)
{

echo "<option value='".$starttime->format('H:i:s')."'>".$starttime->format('H:i:s')."</option>";

$starttime = date_add($starttime, date_interval_create_from_date_string($minutes, ' min'));
}

echo " </select>";

Call to undefined method mysqli_result::result() in Codeigniter

Try this,simple_query will only return true or false according to your query

public function autorun() {
$mysql_query = "show columns from store_accounts";
$query = $this->db->query($mysql_query);
foreach ($query->result() as $row) {
$column_name = $row->Field;
echo $column_name.'<p>';
}
die;
}

Fatal error: Call to undefined function mysqli_result() with click counter function

There is not an exact 1:1 match between the deprecated mysql functions and the mysqli functions. You have to fetch a row as an array, and then inspect an element of it.

Example:

$res = mysqli_query($dbc,$sql);
$row = mysqli_fetch_row($res);
if ($row[0]==0){
. . .


Related Topics



Leave a reply



Submit