Hi i am trying to execute the following query and is coming up with the above error:
the specific code of the query is in bold text. i have put the rest of the code just in case there is something wrong in there instead of the specific code.
Code:
[PHP]<?php
if ($_POST[op] != "add") {
$display_block = "<h1><img src=\"Web Images/Banners/SuitFormTitle1.jpg\"></img></h1>
<div style='margin:0 auto;width:600px;'>
<form action=\"$_SERVER[PHP_SELF]\" method=\"post\">
<div class=\"row\">
<span class=\"item\"><h2>Suit ID</h2></span>
<span class=\"formw\"><input type=\"text\" name=\"Suit_ID\" size=5 /></span>
</div>
<div class=\"row\">
<span class=\"item\"><h2>Smart ID</h2></span>
<span class=\"formw\"><input type=\"text\" name=\"Smart_ID\" value=1 size=5 /></span>
</div>
<div class=\"row\">
<span class=\"item\"><h2>Suit Brand</h2></span>
<span class=\"formw\"><input type=\"text\" name=\"Suit_Brand\" size=20/></span>
</div>
<div class=\"row\">
<span class=\"item\"><h2>Suit Type</h2></span>
<span class=\"formw\"><input type=\"text\" name=\"Suit_Type\" size=20/></span>
</div>
<div class=\"row\">
<span class=\"item\"><h2>Suit Colour</h2></span>
<span class=\"formw\"><input type=\"text\" name=\"Suit_Colour\" size=20/></span>
</div>
<div class=\"row\">
<span class=\"item\"><h2>Suit Price</h2></span>
<span class=\"formw\"><input type=\"text\" name=\"Suit_Price\" size=10/></span>
</div>
<div class=\"row\">
<span class=\"item\"><h2>Suit Image</h2></span>
<span class=\"formw\"><input type=\"text\" name=\"Suit_image\" size=30 value=\"web images\Items\Suits\" /></span>
</div>
<div class=\"row\">
<span class=\"item\"><h2>Suit Description</h2></span>
<span class=\"formw\"><textarea name=\"Suit_Description\" rows=5 cols=20></textarea></span>
</div>
<div class=\"row\">
<span class=\"item\"></span>
<span class=\"formw\"><input type=\"image\" name=\"submit\" src=\"Web Images/Buttons/Submit.jpg\" value=\"Add Entry\" /></span>
<div class=\"row\">
<span class=\"item\"></span>
<span class=\"formw\"><input type=\"hidden\" name=\"op\" value=\"add\"/></span>
</form>
</div>";
}
else if ($_POST[op] == "add") {
if (($_POST[Suit_Brand] == "") || ($_POST[Suit_Type] == "")) {
header ("location:add_suit.php");
exit;
}
$conn = mysql_connect("localhost","root","")
or die (mysql_error());
mysql_select_db("noble",$conn);
$add_Suit = "INSERT INTO Suits
VALUES('$_POST[Suit_ID]','$_POST[Smart_ID]','$_POST[Suit_Brand]','$_POST[Suit_Type]',
'$_POST[Suit_Colour]','$_POST[Suit_Price]','$_POST[Suit_image]',
'$_POST[Suit_Description]')";
if (mysql_query($insert,$conn)) {
echo "Record Added";
} else {
echo mysql_error();
}
$display_block = "<h2>Entry Added</h2>
<p>Add Another Entry?<a href\"add_suit.php\"></a></p>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="Insert_Forms/NobleForms.css"/>
<title>Suit Form</title>
</head>
<body>
<?php echo $display_block; ?>
</body>
</html>[/PHP]
thanks in advance for ur time and effort.