PHP提示Deprecated: mysql_connect(): The mysql extension is deprecated的解决方法
来源:互联网 发布:mac applications 编辑:程序博客网 时间:2024/05/29 15:33
来源:http://www.jb51.net/article/54465.htm
这篇文章主要介绍了PHP提示Deprecated: mysql_connect(): The mysql extension is deprecated的解决方法,是在进行PHP数据库程序开发中常会遇到的错误,需要的朋友可以参考下
本文实例讲述了PHP提示 Deprecated: mysql_connect(): The mysql extension is deprecated的解决方法,在PHP程序开发中常会遇到这类问题。分享给大家供大家参考,具体的解决方法如下:
将下面代码改为mysqli或PDO即可。
1
2
3
4
5
function
connectit () {
global
$CFG
;
mysql_connect(
$CFG
[
'db_host'
],
$CFG
[
'db_user'
],
$CFG
[
'db_pass'
])
or
die
(mysql_error());
mysql_select_db(
$CFG
[
'db_name'
]);
}
PDO:
1
$dbh
=
new
PDO(
'mysql:host=localhost;dbname=test'
,
$user
,
$pass
);
MYSQLI:
1
2
3
4
5
6
7
8
9
10
$link
= mysqli_connect(
'localhost'
,
/* The host to connect to 连接MySQL地址 */
'user'
,
/* The user to connect as 连接MySQL用户名 */
'password'
,
/* The password to use 连接MySQL密码 */
'world'
);
/* The default database to query 连接数据库名称*/
if
(!
$link
) {
printf(
"Can't connect to MySQL Server. Errorcode: %s "
, mysqli_connect_error());
exit
;
}
0 0
- PHP提示Deprecated: mysql_connect(): The mysql extension is deprecated的解决方法
- Deprecated: mysql_connect(): The mysql extension is deprecated的解决方法
- PHP——mysql_connect(): The mysql extension is deprecated
- 解决Deprecated: mysql_connect(): The mysql extension is deprecated
- 解决PHP中Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the futu
- php 报: 解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the f
- 小胖学PHP总结5-----PHP操作SQL数据库(Deprecated: mysql_connect(): The mysql extension is deprecated and will)
- 解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:
- Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: u
- 解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:
- 解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:
- 解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:
- 解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:
- 解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:
- 解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:
- 解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:
- 解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:
- Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: us
- 结合个人经历总结的前端入门方法(这才是真的入门经典)
- Bean的作用域
- java网络编程一
- 【Leetcode】Find Minimum in Rotated Sorted Array
- 文本错误消息提示
- PHP提示Deprecated: mysql_connect(): The mysql extension is deprecated的解决方法
- Obtaining, Configuring and Building unixODBC
- Lesson 21 DanielMendoza
- ASP.NET MVC5-ModelStateDictionary类ModelState模型验证
- Volley框架获取Cookie和带Cookie请求链接
- SessionFactory启动找不到hbm文件
- 学自慕课网:Spring入门
- App 微信分享
- 通过实现一个TableView来理解iOS UI编程