简体   繁体   中英

Connect to go daddy hosted Database using php connection

i keep getting a 500 internal server error when trying to submit my form. The Database is hosted in godaddy.com. I think i have hostname wrong. here is my code.

<?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(); 
?>

是的,您的主机名错误,请阅读查看数据库的详细信息以进一步了解godaddy数据库详细信息

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM