【解决方案】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) {
	die('Could not connect to MySQL: ' . mysql_error());
}
echo 'Connection OK'; mysql_close($link);
?> 

解决方案

将mysql改为mysqli

<?php 
$link = mysqli_connect('localhost','root',''); 
if (!$link) { 
<span style="white-space:pre">	</span>die('Could not connect to MySQL: ' . mysqli_error()); 
} 
echo 'Connection OK'; mysqli_close($link); 
?> 

时间: 2024-08-27 15:15:38

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

小胖学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 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

解决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报错

解决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