douduiti3040 2014-11-20 19:27
浏览 18

无法连接到数据库

<?php 

$link = mysql_connect("localhost", "root", "") or die("Could not connect");

$db = mysql_select_db("goal123", $link) or die("Could not select database");

?>

I got two error messages "The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp\www\Online Banking\db_connect.php on line 3"

and "Warning: mysql_connect(): in C:\wamp\www\Online Banking\db_connect.php on line 3"

After trying something like this

<?php 

$link = mysqli_connect('localhost', 'user', '');
mysqli_select_db('testdb', $link);

?>

I'm still getting a warning message that says "Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in C:\wamp\www\Online Banking\db_connect.php on line 4"

Can somebody help me out

  • 写回答

2条回答 默认 最新

  • dongshi1148 2014-11-20 19:39
    关注
    mysqli_select_db('testdb', $link);
    

    change to

    mysqli_select_db($link,"testdb");
    
    评论

报告相同问题?

悬赏问题

  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大