Im very new to php and my SQL, and am having trouble connecting to my SQL Database. Im getting the following error when i submit my HTML Form.
mysqli_connect(): (HY000/2003): Can't connect to MySQL server on 'domain name' (111)
Here is my php code:
<?
$name=$_POST['name'];
$email=$_POST['email'];
$location=$_POST['location'];
mysqli_connect("domain_name", "1645347_data", "*password omitted*") or die(mysql_error()); //error getting thrown at this line
mysqli_select_db("1645347_data") or die(mysql_error());
mysqli_query("INSERT INTO `data` VALUES ('$name', '$email', '$location')");
Print "Your information has been successfully added to the database.";
?>
As you can see, it is a very simple php script (as I am following a tutorial).
Can anybody see why i would be getting this error? im more than happy to provide additional information if requested.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…