我在尝试提交表单时遇到500内部服务器错误。数据库托管在godaddy.com。我想我的主机名错了。这是我的代码。
<?php
define('DB_NAME','Survey');
define('DB_USER','BC');
define('DB_PASSWORD','*********');
define('DB_HOST','50.62.209.72.secureserver.net');
$link = mysql_connect('DB_HOST', 'DB_USER', 'DB_PASSWORD');
if(!$link) {
die('Could not connect: ' .mysql_error());
}
$db_selected = mysql_select_db(DB_NAME, $link);
if(!$db_selected){
die('Can\'t use '. DB_name . ':' .mysql_error());
}
/*echo 'Connected Successfully';*/
$value = $_POST['last'];
$value2 = $_POST['first'];
$value3 = $_POST['phone'];
$value4 = $_POST['email'];
$value5 = $_POST['fax'];
$value6 = $_POST['company'];
$sql = "INSERT INTO crofton (last, first, Phone, Email, Fax, Company) VALUES ('$value', '$value2', '$value3', '$value4', '$value5', '$value6')";
if (!mysql_query($sql)) {
die('Error: '. mysql_error());
}
mysql_close();
?>