Code should be
<?php
#FileName = "Connection_php_mysql.htm"
#Type = "MYSQL"
#HTTP = "true"
$hostname_Main_DB = "localhost";
$database_Main_DB = "mydb";
$username_Main_DB = "root";
$password_Main_DB = "";
$con = mysqli_connect($hostname_Main_DB,$username_Main_DB,$password_Main_DB, $database_Main_DB) or die ( "Failed to connect to MySQL: " . mysqli_connect_errno());
$db=mysqli_select_db($database_Main_DB,$con) or die( "Failed to connect to MySQL: ".mysqli_connect_errno());
?>
You should remove “new”. For more information read this
Edit :-
Also you have added .
in between two variable that should be ,
$username_Main_DB. $password_Main_DB
replace this with $username_Main_DB,$password_Main_DB
6
solved wamp / php error Fatal error: Class ‘mysqli_connect’ not found in C:\wamp\www\finalproject\Connections\Main_DB.php on line 9 [duplicate]