简体   繁体   English

你如何解决这个错误mysql

[英]how do you fix this error mysql

I'm not sure how to address this issue:我不知道如何解决这个问题:

EDIT: can someone just edit my code with the corrections because this is due tmrw.编辑:有人可以通过更正来编辑我的代码,因为这是由于 tmrw.

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\\xampp\\htdocs\\login\\login-registration-php\\login-registration-php-new\\dbconnect.php:6 Stack trace: #0 C:\\xampp\\htdocs\\login\\login-registration-php\\login-registration-php-new\\index.php(4): require_once() #1 {main} thrown in C:\\xampp\\htdocs\\login\\login-registration-php\\login-registration-php-new\\dbconnect.php on line 6致命错误:未捕获的错误:调用 C:\\xampp\\htdocs\\login\\login-registration-php\\login-registration-php-new\\dbconnect.php:6 堆栈跟踪:#0 C:\\ 中未定义的函数 mysql_connect() xampp\\htdocs\\login\\login-registration-php\\login-registration-php-new\\index.php(4): require_once() #1 {main} 抛出在 C:\\xampp\\htdocs\\login\\login-registration-第 6 行的 php\\login-registration-php-new\\dbconnect.php

    <?php

// this will avoid mysql_connect() deprecation error.
error_reporting( ~E_DEPRECATED & ~E_NOTICE );
// but I strongly suggest you to use PDO or MySQLi.
$conn = mysql_connect(localhost,nathan,password);
$dbcon = mysql_select_db(dbtest);

if ( !$conn ) {
    die("Connection failed : " . mysql_error());
}

if ( !$dbcon ) {
    die("Database Connection failed : " . mysql_error());
}

请检查 extension=mysqli.so 和 extension=mysql.so 都在你的 php.ini 中取消注释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM