C1D C1D - 1 month ago 7
MySQL Question

Moving to mysqli, mysql_result

I am converting my project from mysql to mysqli and my problem is that

mysqli_result()
does not work with my old code. My old code is:
mysql_result($res,0,0);


When I try adding
mysqli_result()
with my old code it will not work.

Is there another way that'll work with my old parameters?

Answer

mysqli_result() will not work with your old parameters so you need to create a new function, Here is the code for a function that'll work with your old prameters:

function mysqli_result($res, $row, $field=0) { 
    $res->data_seek($row); 
    $datarow = $res->fetch_array(); 
    return $datarow[$field]; 
}
Comments