我试图用php和myadmin连接到mysql数据库。我试了很多代码,我可以在网上找到,但我不能把这个东西去工作... 任何人都可以请告诉我,我可能会做错什么吗? 这是PHP脚本我使用:无法连接到MySQL
<?php
$useremail = $_POST["useremail"];
$password = $_POST["password"];
if($useremail && $password){
// open database
$connect = mysql_connect("localhost", "carlos", "nenem");
if(!$connect){
die ("Not able to connected to the database: " .mysql_error());
}
// select database
$select_db = mysql_select_db("vergilioDB", $connect);
if(!$connect_db){
die("Not able to connect to the database: " .mysql_error());
}
mysql_close($connect);
} else {
die("Please enter useremail and password, or REGISTER if you are a new user!");
}
?>
您需要提供更多信息,比如你在什么时候得到什么错误。 – FatherStorm 2011-03-08 16:54:54
你收到什么(如果有)错误信息? – 2011-03-08 16:55:08
你收到什么错误? – Teekin 2011-03-08 16:55:14