view raw
YUSUF KIPROP YUSUF KIPROP - 11 months ago 35
PHP Question

issue with mysqli function

My page displays this error

"mysqli_query() expects at least two parameters, one given on line $result=mysqli_query($connect);"

Here is my code:

*FROM $tbl_name WHERE phone
='$phone' and
password= '$password'");


you did this

mysqli_query($connect,"SELECT * FROM $tbl_name WHERE phone ='$phone' and  password= '$password'");

I think you want to make the query in a variable, then call mysqli_query using that variable..
So the correct way to do this is :

$con = mysqli_connect("", "my_user", "my_password", "my_db");
$query = "SELECT * FROM $tbl_name WHERE phone ='$phone' and password= '$password'"; mysqli_query($con, $query);

Where $con is your connection string, and $query is your Query string