<分区>
我正在使用 Ajax 搜索表单,在连接到数据库后,将在键入时显示搜索词。
但是我的网站上出现了数据库连接问题。
这是我的连接文件 (db.inc) 中的代码:
<?php
$username = "xxxx";
$password = "xxxx";
$hostname = "xxxx";
$database = "xxxx";
mysqli_connect($hostname, $username, $password) or die(mysql_error());
mysqli_select_db($database) or die(mysqli_error());
?>
但是在前端,我收到如下错误:
Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in xxxx/db.inc.php on line 9
Warning: mysqli_error() expects exactly 1 parameter, 0 given in xxxx/db.inc.php on line 9
任何人都可以检查我做错了什么吗?我已经在上面粘贴了完整的 db.inc 文件。
预先感谢您的帮助。