升级到MySQLi-就像将mysql换成mysqli一样容易吗? [英] Upgrading to MySQLi - As easy as swapping out mysql for 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
将替换为mysqli_connect
-
mysql_error
将替换为mysqli_error
和/或mysqli_connect_error
,具体取决于上下文 -
mysql_query
将替换为mysqli_query
mysql_connect
will be replaced bymysqli_connect
mysql_error
will be replaced bymysqli_error
and/ormysqli_connect_error
, depending on the contextmysql_query
will be replaced bymysqli_query
这篇关于升级到MySQLi-就像将mysql换成mysqli一样容易吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!