本文介绍了移至mysqli,mysql_result的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将我的项目从mysql转换为mysqli,我的问题是mysqli_result()不适用于我的旧代码.我的旧代码是:mysql_result($res,0,0);

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);

当我尝试用旧代码添加mysqli_result()时,它将不起作用.

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?

推荐答案

mysqli_result()不适用于您的旧参数,因此您需要创建一个新函数,以下是该函数的代码,可以与您的旧参数一起使用参数:

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]; 
}

这篇关于移至mysqli,mysql_result的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 17:43