2017-07-18 99 views
0

你好一个尝试连接到数据库,我不能这样做,我运行程序与龙虾,并显示此错误。 数据库连接是用adodb和mysql连接的。 感谢您的帮助。错误与连接在php中的adodb

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ADODB_Cache_File has a deprecated constructor in C:\laragon\www\FacturaElectronicaAlumgo\sistema\adodb5\adodb.inc.php on line 233 
 

 
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ADOConnection has a deprecated constructor in C:\laragon\www\FacturaElectronicaAlumgo\sistema\adodb5\adodb.inc.php on line 327 
 

 
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ADORecordSet has a deprecated constructor in C:\laragon\www\FacturaElectronicaAlumgo\sistema\adodb5\adodb.inc.php on line 2854 
 

 
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ADORecordSet_array has a deprecated constructor in C:\laragon\www\FacturaElectronicaAlumgo\sistema\adodb5\adodb.inc.php on line 3872 
 

 
Fatal error: Uncaught Error: Call to undefined function mysql_pconnect() in C:\laragon\www\FacturaElectronicaAlumgo\sistema\adodb5\drivers\adodb-mysql.inc.php:383 Stack trace: #0 C:\laragon\www\FacturaElectronicaAlumgo\sistema\adodb5\adodb.inc.php(588): ADODB_mysql->_pconnect('localhost', 'root', 'black44265769', 'cal24412_dte') #1 C:\laragon\www\FacturaElectronicaAlumgo\sistema\conexion.php(3): ADOConnection->PConnect('localhost', 'root', 'black44265769', 'cal24412_dte') #2 C:\laragon\www\FacturaElectronicaAlumgo\sistema\validar.php(8): include('C:\\laragon\\www\\...') #3 {main} thrown in C:\laragon\www\FacturaElectronicaAlumgo\sistema\adodb5\drivers\adodb-mysql.inc.php on line 383

回答

1

PHP的版本?由于“不推荐”消息和最后一个“致命”错误,我在这里假设7.x(可能)。

这是一个两部分的事情...

  1. 的弃用:

    PHP已经进行了更改使用__construct() (两个前导下划线)作为构造函数,而不是具有相同名称的班级本身。有关更多信息,请参阅PHP 4 style constructors部分(页面上的第一部分)。

    例如:在文件ADOConnection has a deprecated constructor...构造可能是这样的:

    ADOConnection(...); // constructors with or without parameters 
    

    ......但所有这些都可以被替换为:

    __construct(...); 
    

    可以做出的改变在本地解决已弃用的消息。

  2. 致命错误:

    使用PHP 7.x中,该mysql_ *基于功能 删除。见this API info

+0

感谢您的回答,Y解决dreprecate错误,现在我尝试用你解决致命错误相同的API信息你的答案对我帮助很大,真的很感谢PD: 我不习惯与合作PHP和我在公司里面有很多错误的系统,所以对我来说有点困难,并且再次感谢 –

+0

为了解决这个问题,你将无法使用'mysql_ *'。您将需要使用'mysqli_ *'(注意后面的** i **)或PDO处理。 –

+0

我能够解决我的问题 非常感谢你 –