I'm working on an inventory database and I keep getting the following error message:
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 'lock='', model='E-4200', serial='20085781', asset=' at line 8
However I keep going over the code and it looks fine:
// if anything has been submitted, insert it into the database
$whee = "";
if($_POST)
{
$wow = mysqli_query($conn,"SELECT name FROM hardware WHERE ip=$client[3]");
// get computer name to user in upcoming query
while ($r = mysqli_fetch_array($wow))
{
extract($r);
$whee = $name;
}
// update hardware info
$querre = "UPDATE hardware SET name='" .$_POST['name']. "',
dept='" .$_POST['dept']. "',
building='" .$_POST['building']. "',
room='" .$_POST['room']. "',
user='" .$_POST['user']. "',
speakers='" .$_POST['speakers']. "',
label='" .$_POST['label']. "',
lock='" .$_POST['lock']. "',
model='" .$_POST['model']. "',
serial='" .$_POST['serial']. "',
asset='" .$_POST['asset']. "',
monitor='" .$_POST['monitor']. "',
memory='" .$_POST['memory']. "',
hd='" .$_POST['hd']. "',
ip='" .$_POST['ip']. "',
data='" .$_POST['data']. "',
notes='" .$_POST['notes']. "' WHERE name=\"$whee\"";
if (mysqli_query($conn,$querre)) {
echo "Hardware Information Updated. ";
} else {echo "<p style=\"color:red\">\n".mysqli_error($conn)."</p>";}
// update software info
$querie = "UPDATE software SET name='" .$_POST['name']. "',
ad_aware='" .$_POST['ad_aware']. "',
adobe_reader='" .$_POST['adobe_reader']. "',
filemaker_pro='" .$_POST['filemaker_pro']. "',
vscan='" .$_POST['vscan']. "',
mochasoft='" .$_POST['mochasoft']. "',
ms_antispyware='" .$_POST['ms_antispyware']. "',
netscape='" .$_POST['netscape']. "',
office='" .$_POST['office']. "',
pyramed='" .$_POST['pyramed']. "' WHERE name=\"$whee\"";
if (mysqli_query($conn,$querie)) {
echo "Software Information Updated. ";
} else {echo "<p style=\"color:red\">\n".mysqli_error($conn)."</p>";}
}
And just looking at my hardware query ("querry"), I can't find what the error is. Little help?