Z
zanadoo88
Guest
So, I have a very simple HTML form that points to the following PHP code. I am sure that the information specific to the database is right (username, etc). There might be a problem specific to the database (my host is godaddy and they aren't being helpful), however I'd like to know if there is a problem with my PHP syntax.
<?
$username="Test12";
$password="Password44";
$database="MyDatabase";
$name=$_POST['Title'];
$html=$_POST['HTML'];
$description=$_POST['Description'];
$link=mysql_connect(("p42mysql1872.secureserver.net", $username,$password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$query="insert into chewytable (name, HTML, description) values ('$name', '$html', '$description')"
mysql_query($query);
mysql_close($link);
?>
re: nidinthb
still doesn't work, but new error message
Parse error: syntax error, unexpected T_STRING in /home/content/x/a/n/xanderz1/html/insert3.php on line 13
<?
$DBuser = Ape1; //(fill your DB username)
$DBpass = "ThePassword"; //(fill your password)
$DBhost =localhost;
$DBName = "Hellwy1"; // (fill your DB name)
$DBConn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Error in Application: " . mysql_error()); // Select mySQL Database
mysql_select_db($DBName, $DBConn) or die("Error in Application: " . mysql_error());
$query="insert into happytable (name, HTML, description) values ('$name', '$html', '$description')"
mysql_query($query);
mysql_close($link);
?>
<?
$username="Test12";
$password="Password44";
$database="MyDatabase";
$name=$_POST['Title'];
$html=$_POST['HTML'];
$description=$_POST['Description'];
$link=mysql_connect(("p42mysql1872.secureserver.net", $username,$password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$query="insert into chewytable (name, HTML, description) values ('$name', '$html', '$description')"
mysql_query($query);
mysql_close($link);
?>
re: nidinthb
still doesn't work, but new error message
Parse error: syntax error, unexpected T_STRING in /home/content/x/a/n/xanderz1/html/insert3.php on line 13
<?
$DBuser = Ape1; //(fill your DB username)
$DBpass = "ThePassword"; //(fill your password)
$DBhost =localhost;
$DBName = "Hellwy1"; // (fill your DB name)
$DBConn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Error in Application: " . mysql_error()); // Select mySQL Database
mysql_select_db($DBName, $DBConn) or die("Error in Application: " . mysql_error());
$query="insert into happytable (name, HTML, description) values ('$name', '$html', '$description')"
mysql_query($query);
mysql_close($link);
?>