解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in

php 5个版本,5.2、5.3、5.4、5.5,怕跟不上时代,新的服务器直接上5.5,但是程序出现如下错误:Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in,看意思就很明了,说mysql_connect这个模块将在未来弃用,请你使用mysqli或者PDO来替代。

解决方法1:

禁止php报错

display_errors = On
改为
display_errors = Off

鉴于这个服务器都是给用户用的,有时候他们需要报错(…都是给朋友用的,^_^),不能这做,让他们改程序吧,看方案2.

解决方法2:

常用的php语法连接mysql如下

<?php
$link = mysql_connect(‘localhost‘‘user‘‘password‘);
mysql_select_db(‘dbname‘$link);
 
改成mysqi
<?php
$link = mysqli_connect(‘localhost‘‘user‘‘password‘‘dbname‘);

常用mysql建表SQL如下

<?php
//  老的
mysql_query(‘CREATE TEMPORARY TABLE `table`‘$link);
// 新的
mysqli_query($link‘CREATE TEMPORARY TABLE `table`‘);

解决方法三:

在php程序代码里面设置报警级别

<?php
error_reporting(E_ALL ^ E_DEPRECATED);

Deprecated的问题就这样解决掉了,不过还是建议大家尽快取消mysql的用法,全部都走向mysqli或者mysqlnd等等。mysql确实是太不安全而且太老旧了。

时间: 2024-10-07 12:17:17

解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in的相关文章

解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:

php5个版本,5.2.5.3.5.4.5.5,怕跟不上时代,新的服务器直接上5.5,但是程序出现如下错误:Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in,看意思就很明了,说mysql_connect这个模块将在未来弃用,请你使用mysqli或者PDO来替代. 解决方法1: 禁止PHP报错 d

PHP提示Deprecated: mysql_connect(): The mysql extension is deprecated的解决方法

这篇文章主要介绍了PHP提示Deprecated: mysql_connect(): The mysql extension is deprecated的解决方法,是在进行PHP数据库程序开发中常会遇到的错误,需要的朋友可以参考下 本文实例讲述了PHP提示 Deprecated: mysql_connect(): The mysql extension is deprecated的解决方法,在PHP程序开发中常会遇到这类问题.分享给大家供大家参考,具体的解决方法如下: 将下面代码改为mysqli

小胖学PHP总结5-----PHP操作SQL数据库(Deprecated: mysql_connect(): The mysql extension is deprecated and will)

第一:打开数据库 要操作SQL数据库,首先必须于MySQL服务器建立连接,连接MySQL服务器的语句: mysql_connect('hostname','username','password') 该函数的返回值用于表示这个数据库连接成功,如果连接成功,则会返回一个资源,为以后执行SQL指令做准备. <?php $link = mysql_connect("localhost:3306","root","123456") or die(&

【解决方案】Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in F:\Program Files (x86)\wamp\www\testmysql.php on line 2 <?php $link = mysql_connect('localhost','root',''); if (!$link) { d

解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

因为最近更新的PHP版本,写sql语句,忽然发现不能用了,上网查了一些原因,找到几个方法如下: 1.禁止php报错 display_errors = on 改成 display_errors = off 2.将PHP中的mysql用PDO或者是mysqli代替就不会发生这种情况了 3.php设置报警级别  error_reporting(E_ALL ^ E_DEPRECATED);

MYSQL版本问题:解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future.

[mysql] mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in

From: http://www.ttlsa.com/php/deprecated-mysql-connect/ php 5个版本,5.2.5.3.5.4.5.5,怕跟不上时代,新的服务器直接上5.5,但是程序出现如下错误:Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in,看意思就很明了,说my

解决MYSQL弃用模块错误Deprecated: mysql_query(): The mysql extension is deprecated and will be removed in the future

今天使用了mysql 5.5版本,就出现了错误.错误提示如下: Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in 看意思就很明了,说mysql_connect这个模块将在未来弃用,请你使用mysqli或者PDO来替代.所以说这个应该说是提示更恰当. 现在知道这个错误是什么原因引起的,那么就很好解

tp框架报“mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead” 警告信息

警告信息是“mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead……\ThinkPHP\Library\Think\Db\Driver\Mysql.class.php 第 52 行.” 就是建议你用mysqli或者pdo连连接数据库,因为mysql_connect()在未来将要被移除: 这只是一个警告信息,当做没看见也阔以,去p