Tuesday, July 31, 2018

Cant connect my database with php




$con = mysqli_connect("localhost" "root" "") or die("Unable to connect");
mysqli_select_db("logindb", $con);
?>


This is the configuration of the connecting.




require 'config.php';
?>


This is where is connect the database to a registration page.



Can you see something wrong? This is the error i get:
Parse error: syntax error, unexpected '"root"' (T_CONSTANT_ENCAPSED_STRING)




Thanks,
Realcookie


Answer



You are missing the commas bro. Here is the corrected one



$con = mysqli_connect("localhost", "root", "") or die("Unable to connect");
mysqli_select_db($con, 'logindb');
?>


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...