The official method to replace mysql_result with mysqli in php

WBOY
Release: 2016-08-08 09:24:25
Original
1634 people have browsed it

I upgraded the php version today, and by the way, I want to change the mysql connection method in the php code to mysqli, because the official has been recommending mysqli and pdo since php5.3. Not much to say, just post the code

<code><span>// here's a rough replacement using mysqli:</span><span>// 错略的使用mysqli替换</span><span>if</span> (!function_exists(<span>'mysql_result'</span>)) {
    <span><span>function</span><span>mysql_result</span><span>(<span>$result</span>, <span>$number</span>, <span>$field</span>=<span>0</span>)</span> {</span>
        mysqli_data_seek(<span>$result</span>, <span>$number</span>);
        <span>$row</span> = mysqli_fetch_array(<span>$result</span>);
        <span>return</span><span>$row</span>[<span>$field</span>];
    }
}</code>
Copy after login

php official website: http://php.net/manual/zh/function.mysql-result.php

The above introduces the official method of replacing mysql_result with mysqli in PHP, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template