Simmi Simmi - 16 days ago 6
PHP Question

Connecting database mysql localhost

I am trying to connect MySql database by running following query but it always throws an error.

mysqli_query("localhost","","root","testdb");
if($con) {
echo "Connected";
} else {
echo "Not Connected";
}

sam sam
Answer

You are passing arguments in wrong order.

try this way

mysqli_connect("localhost","root","","testdb");

Use mysqli_connect query