升级到MySQLi-就像将mysql换成mysqli一样容易吗? [英] Upgrading to MySQLi - As easy as swapping out mysql for mysqli?

查看:113
本文介绍了升级到MySQLi-就像将mysql换成mysqli一样容易吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我看到许多不同的帖子上都做出了很多回应之后,我停止使用mysql,并试图升级我的网站以使用mysqli.

After a lot of responses on a number of different posts I've seen, I'm stopping using mysql and am trying to upgrade my site to use mysqli.

我的问题是,根据我在下面列出的mysql的功能(我当前使用的功能),我可以对mysqli_进行mysql_的大范围替换,而不会破坏功能吗?我已经对这些功能中的每一个进行了一些研究,并且没有一个mysqli版本看起来不起作用,但是我只需要确定在将它们全部换出之前即可.

My question is, based on the functions of mysql that I list below (which are the ones I currently use) can I do a blanket replace on 'mysql_' for 'mysqli_' and not break functionality? I've already done some research on each of these functions and none of the mysqli versions look like they wouldn't work, but I just need to be sure before I swap them all out.

查询

fetch_array

fetch_array

连接

select_db

select_db

错误

real_escape_string

real_escape_string

num_rows

fetch_assoc

fetch_assoc

free_result

free_result

推荐答案

查看

Check out this SO question which provides answers to at least most of your functions.

例如:

  • mysql_connect will be replaced by mysqli_connect
  • mysql_error will be replaced by mysqli_error and/or mysqli_connect_error, depending on the context
  • mysql_query will be replaced by mysqli_query

这篇关于升级到MySQLi-就像将mysql换成mysqli一样容易吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆