I am having a problem with my code.
We all know mysql_result
is deprecated. So what I've done is created a similar function to replace mysql_result
with mysqli_result
. My code is shown below.
function mysqli_result($result, $row, $field = 0) {
$result->data_seek($row);
$data = $result->fetch_array();
return $data[$field];
}
Use this code if you need to for your own projects, it works perfect on almost all my pages. On-topic, on some of my pages which uses mysqli_connect
, I'm getting an error.
Fatal error: Call to a member function data_seek() on boolean in ... on line 4
Then we have line 4, which is
$result->data_seek($row);
I'm asking you nicely, how can I adjust my code so it does not give this error anymore? Or maybe dump the code so it doesn't appear anymore.
I've also tried looking up the error on Google, it didn't gave me any answers really.
EDIT: Give us source code where you are calling the function.
if(mysqli_result(mysqli_query($GLOBALS["___mysqli_ston"], "SELECT COUNT(id) FROM downloads"),0) == 0) {
echo 'No downloads were added.';
}