hi I’m new here with a real simple newbie problem I just can’t solve. I’ve a connection to my database but can’t the query to insert, or get an error message back. I have other ‘select’ scripts that work so the connection works. What am I doing wrong??? and why don’t I get any errors returned?
TIA
<html>
<head>
<title>Input Links</title>
</head>
<body>
<H1 align=center><FONT color=blue>Web Content Control Panel</FONT></H1><br>
<TABLE align=center>
<TR>
<TD>
<?php
//ini_set('display_errors',1);
//error_reporting(E_ALL);
//connect to database
$db = mysql_connect("localhost", "user", "*******") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("my_db",$db);
if ($submit) {
$sql = "INSERT INTO links (link_desc, link_url) VALUES ('$link_desc','$link_url')";
// run SQL against the DB
$result = mysql_query($sql,$db);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
echo "<h3 align=center>Link Entered!</h3><br>";
// Close the database connection
mysql_close();
}
?>
</td></tr>
<tr><td>
<!-- display form for links entry -->
<form method="post" name="myForm" action="<?php echo $_SERVER['PHP_SELF'] ?> " >
<TABLE align=center border=1>
<TR><TD align=right>Link Description :</TD><TD><input type="Text" name="link_desc" size="100" ></TD></TR>
<TR><TD align=right> URL:</TD><TD><input type="Text" name="link_url" size="50" ></Textarea></TD></TR>
<TR><TD><input type="Submit" name="submit" value="Add Link"></TD><TD></TD></TR>
</TABLE>
</form>
</body>
</html>