Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
575 views
in Technique[技术] by (71.8m points)

php - 致命错误:未捕获错误:调用未定义函数mysql_connect()(Fatal error: Uncaught Error: Call to undefined function mysql_connect())

I am trying to do a simple connection with XAMPP and MySQL server, but whenever I try to enter data or connect to the database, I get this error.

(我试图与XAMPP和MySQL服务器建立简单连接,但是每当我尝试输入数据或连接到数据库时,都会出现此错误。)

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\register.php:22

(致命错误:未被捕获的错误:调用C:\ xampp \ htdocs \ register.php:22中未定义的函数mysql_connect())
Stack trace: #0 {main} thrown in C:\xampp\htdocs\register.php on line 22

(堆栈跟踪:在第22行的C:\ xampp \ htdocs \ register.php中抛出#0 {main})

Example of line 22:

(第22行的示例:)

$link = mysql_connect($mysql_hostname , $mysql_username);
  ask by Demeteor translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

mysql_* functions have been removed in PHP 7.

(mysql_*函数已在PHP 7中删除。)

You probably have PHP 7 in XAMPP.

(您可能在XAMPP中具有PHP 7。)

You now have two alternatives: MySQLi and PDO .

(现在,您有两种选择: MySQLiPDO 。)

Additionally, here is a nice wiki page about PDO.

(此外, 是一个关于PDO的漂亮Wiki页面。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...