I'm attempting to write a script to add authorized user info to a db so that I can create a client lookup for my sales staff and use the same db as a user authorization for my secure site.
Slugged my way pretty far with out too many problems.. but now I'm stuck
Error received is:
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 '(symbol, acctname, acctcontact, acctgreeting, address, city, st
Script is:
<?
//Confirm mandatory fields
if ((!$POST[symbol]) || (!$POST[acctname]) || (!$POST[acctcontact]) || (!$POST[address]) || (!$POST[city]) || (!$POST[home]) || (!$POST[terms]) || (!$POST[accttype]) || (!$POST[discgames]) || (!$POST[disccomics])) {
header( "Location: http://Form.html");
exit;
}
?>
<?
$db_name = "hobbies";
$table_name = "client_file";
$connection = @mysql_connect("removed", "removed", "removed")
or die(mysql_error());
$db = @mysql_select_db($db_name, $connection)
or die(mysql_error());
$sql = "INSERT INTO $TABLE_NAME (symbol, acctname, acctcontact, acctgreeting, address, city, state, zip, shop, fax, cell, home, terms, email, accttype, discgames, disccomics, login, passw, notes) VALUES ('$POST[symbol]', '$POST[acctname]', '$POST[acctcontact]', '$POST[acctgreeting]', '$POST[address]', '$POST[city]', '$POST[state]', '$POST[zip]', '$POST[shop]', '$POST[fax]', '$POST[cell]', '$POST[home]', '$POST[terms]', '$POST[email]', '$POST[accttype]', '$POST[discgames]', '$POST[disccomics]', '$POST[login]', '$POST[passw]', '$POST[notes]')";
$result = @($sql,$connection)
or die(mysql_error());
?>
<html>
<head>
<title>Add a Client</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#CCFFCC" text="#000000">
<H2>Adding a client to <? echo "$table_name"; ?></H2>
<table width="100%" cellspacing="0" bgcolor="#006633" border="1">
<tr>
<td height="377">
<table width="100%" border="0" cellspacing="0" bgcolor="#CCFFCC" height="357">
<tr>
<td width="41%"><b>Account Symbol: </b>
<? echo "$POST[symbol]"; ?>
<td width="59%"><b>Account Name:
<? echo "$POST[acctname]"; ?>
</b></td>
</tr>
<tr>
<td width="41%"><b>Account Primary Contact:</b>
<? echo "$POST[acctcontact]"; ?>
</td>
<td width="59%"><b>Account Greeting Name:
<? echo "$POST[acctgreeting]"; ?>
</b></td>
</tr>
<tr>
<td width="41%"><b>Address:
<? echo "$POST[address]"; ?>
</b></td>
<td width="59%"><b>City:
<? echo "$POST[city]"; ?>
</b></td>
</tr>
<tr>
<td width="41%"><b>State:
<? echo "$POST[state]"; ?>
</b></td>
<td width="59%"><b>Zip:
<? echo "$POST[zip]"; ?>
</b></td>
</tr>
<tr>
<td width="41%"><b>Shop #:
<? echo "$POST[shop]"; ?>
</b></td>
<td width="59%"><b>Fax #:
<? echo "$POST[fax]"; ?>
</b></td>
</tr>
<tr>
<td width="41%"><b>Cellular #:
<? echo "$POST[cell]"; ?>
</b></td>
<td width="59%"><b>Home #:</b>
<? echo "$POST[home]"; ?>
</tr>
<tr>
<td width="41%"><b>Terms: </b>Net
<? echo "$POST[terms]"; ?>
</td>
<td width="59%"><b>E-mail Address:
<? echo "$POST[email]"; ?>
</b></td>
</tr>
<tr>
<td width="41%"><b>Account Type:
<? echo "$POST[accttype]"; ?>
</b></td>
<td width="59%"><b>Games Discount:
<? echo "$POST[discgames]"; ?>
Comics Discount:
<? echo "$POST[disccomics]"; ?>
</b></td>
</tr>
<tr>
<td width="41%"><b>Web Login:
<? echo "$POST[login]"; ?>
</b></td>
<td width="59%">
<p><b>Web Password:
<? echo "$POST[passw]"; ?>
</b></p>
</td>
</tr>
<tr>
<td colspan="2" height="61">
<p align="center"><b> </b></p>
<p align="center"><b>Additional Notes:<br>
<? echo stripslashes($POST[notes]); ?>
</b></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p align="center"><a href="show_addrecord.php"><font size="4"><b>Add Another?</b></font></a></P>
</body>
</html>
BTW this is based off a script in PHP fast&easy web development by Julie Meloni
Any (ANY) help would be apriciated.