The second query works fine by itself, so why doesn't it work when the first query is in front of it and the else is triggered?
still spits out the print with no errors.
[PHP]
<? include("dbconnect.php");
$result = mysql_query("SELECT CTRL_NUM "
. "FROM inventory "
."WHERE CTRL_NUM = $_POST[ctrl_num] ");
$res = mysql_fetch_array($result);
if( $_POST[ctrl_num] = $res[0])
{
print ("Record could not be added."); print ("Item already exists.");
}
else
{
mysql_query ("INSERT INTO inventory (CTRL_NUM, PART_NUM, SHELF_BIN, UNIT_ISSUE, PART_TYPE, WHSE, VENDOR, MANUFACTUR, SYSTEM, DOM, SUB_SYS, validation, Repairstat, QAstat)
VALUES ('$_POST[ctrl_num]', '$_POST[part_num]', '$_POST[shelf_bin]', '$_POST[unit_issue]', '$_POST[part_type]', '$_POST[whse]', '$_POST[vendor]', '$_POST[manufactur]', '$_POST[system]', '$_POST[dom]', '$_POST[sub_sys]', '$_POST[validation]', '$_POST[repairstat]', '$_POST[qastat]')");
print ("Your record has been added.");
}
mysql_close();
?>
[/PHP]