Jump to content

SQL Syntax error


aebstract

Recommended Posts

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DESC,LOC,PRICE,SPARE)VALUES ('BPRS2-SAF-1000', 'MEYN', 'REHANGER SAFETY ARM STAT' at line 1

 

 

<?php
session_start();
header("Cache-control: private");

if (isset ($_POST['submit'])) {
$problem = FALSE;


include "../connect/todb.php";


if (!$problem) {

$pn = $_POST['pn'];
$mchn = $_POST['mchn'];
$desc = $_POST['desc'];
$loc = $_POST['loc'];
$price = $_POST['price'];
$spare = $_POST['spare'];



MYSQL_QUERY("INSERT INTO parts (PN,MCHN,DESC,LOC,PRICE,SPARE)".
"VALUES ('$pn', '$mchn', '$desc', '$loc', '$price', '$spare')") or die (mysql_error());


                      header("Location: newparts.php");

} else {
$content .= "$error";
}
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>setup account</title>

</head>

<body>








<?php
$content .= '<form action="newparts.php" method="post">
<br />
PN: <br /><input type="text" maxlength="100" class="textfield" name="pn" size="40" value="' . $_POST[pn] . '" /><br /><br />
MCHN: <br /><input type="text" maxlength="100" class="textfield" name="mchn" size="40" value="' . $_POST[mchn] . '" /><br /><br />
DESC: <br /><input type="text" maxlength="100" class="textfield" name="desc" size="40" value="' . $_POST[desc] . '" /><br /><br />
LOC: <br /><input type="text" maxlength="100" class="textfield" name="loc" size="40" value="' . $_POST[loc] . '" /><br /><br />
PRICE: <br /><input type="text" maxlength="100" class="textfield" name="price" size="40" value="' . $_POST[price] . '" /><br /><br />
SPARE: <br /><input type="text" maxlength="100" class="textfield" name="spare" size="40" value="' . $_POST[spare] . '" /><br /><br />



<input type="submit" name="submit" value="submit" class="textfield" /></form>';



echo "$content";
?>




</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/94482-sql-syntax-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.