简体   繁体   English

移至mysqli,mysql_result

[英]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. 我正在将项目从mysql转换为mysqli,我的问题是mysqli_result()无法与旧代码一起使用。 My old code is: mysql_result($res,0,0); 我的旧代码是: mysql_result($res,0,0);

When I try adding mysqli_result() with my old code it will not work. 当我尝试用旧代码添加mysqli_result()时,它将无法工作。

Is there another way that'll work with my old parameters? 还有另一种方法可以处理我的旧参数吗?

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: mysqli_result()无法与您的旧参数一起使用,因此您需要创建一个新函数,这是将与您的旧参数一起使用的函数的代码:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM