嗨,有人可以在这个问题上帮助我。
这是我的连接字符串:
<?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());
?>
我已安装wamp
服务器且已启用mysqli
扩展程序。
希望你能帮我解决这个问题,
Tnx,Yotam
答案 0 :(得分:1)
$con = mysqli_connect(..);
删除新关键字。
答案 1 :(得分:0)
代码应
<?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());
?>
你应该删除&#34; new&#34;。有关详细信息,请参阅 this
修改: -
此外,您已在两个应为.
,
$username_Main_DB. $password_Main_DB
将其替换为$username_Main_DB,$password_Main_DB