我的页面显示此错误"mysqli_query() expects at least two parameters, one given on line $result=mysqli_query($connect);"
这是我的代码:
mysqli_query($connect,"SELECT
*FROM $tbl_name WHERE phone
='$phone' and
password= '$password'");
$result=mysqli_query($connect);
$count=mysqli_num_rows
($result);
if($count==1){
....}
答案 0 :(得分:-2)
你这样做了
mysqli_query($connect,"SELECT * FROM $tbl_name WHERE phone ='$phone' and password= '$password'");
$result=mysqli_query($connect);
我想你想在变量中进行查询,然后使用该变量调用mysqli_query ..
所以正确的方法是:
$con = mysqli_connect("127.0.0.1", "my_user", "my_password", "my_db");
$query = "SELECT * FROM $tbl_name WHERE phone ='$phone' and password= '$password'";
mysqli_query($con, $query);
$con
是您的连接字符串,$query
是您的查询字符串