问答详情
源自:7-2 PHP数据库扩展

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in D:\wamp64\Demo\test2.php on line 2

为什会出现这个错误,

<?php
$link = mysql_connect('localhost', 'root', 'root') or die('数据库连接失败');
mysql_select_db('db_student');
mysql_query("set names 'utf8'");
$result = mysql_query('select * from tb_admin limit 1');
$row = mysql_fetch_assoc($result);
print_r($row);
?>

这是我的代码

提问者:慕用8951420 2016-11-05 16:38

个回答

  • 慕沐7363818
    2018-08-14 16:23:04

    http://php.net/manual/zh/function.mysqli-connect.php

  • h_2015
    2016-11-06 19:15:51

    mysql 扩展没有开吧