问题
hi could someone assist me in this issue.
this is my connection string:
<?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 = new 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());
?>
I have installed wamp
server and mysqli
extension is enabled.
hope you will be able to help me with this issue,
Tnx, Yotam
回答1:
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
回答2:
$con = mysqli_connect(..);
Remove the new keyword.
来源:https://stackoverflow.com/questions/27776955/wamp-php-error-fatal-error-class-mysqli-connect-not-found-in-c-wamp-www-fi