I have the following code, which yields the following error -
There was a problem with the query: INSERT INTO General (Ticker, Ticker2, Company, Country, Sector, Industry, Competitor, Competitor2, Competitor3, Competitor4, Competitor5, Competitor6, FinUnits, Currency, Description, Index1, Index2, CorporateStatus) VALUES ('AMP', '', 'NULL', '', '', '', '', '', '', '', '', '', '', '', '', '', '', )
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 ')' at line 1
<html>
<head>
<title> PSC Data </title>
</head>
<body>
<?php
$db = mysql_connect('host', 'username', 'password');
if(!$db) {
print "Error - cound not connect to server";
exit;
}
$er = mysql_select_db('prent32_FinDat');
if(!$er) {
print "Error - cound not connect to database";
exit;
}
$IDNumber = "";
$Company = $_POST['Company'];
$Description = $_POST['Description'];
$Ticker = $_POST['Ticker'];
$Ticker2 = $_POST['Ticker2'];
$Sector = $_POST['Sector'];
$Industry = $_POST['Industry'];
$Country = $_POST['Country'];
$Currency = $_POST['Currency'];
$Index1 = $_POST['Index1'];
$Index2 = $_POST['Index2'];
$Competitor = $_POST['Competitor'];
$Competitor2 = $_POST['Competitor2'];
$Competitor3 = $_POST['Competitor3'];
$Competitor4 = $_POST['Competitor4'];
$Competitor5 = $_POST['Competitor5'];
$Competitor6 = $_POST['Competitor6'];
$FinUnits = $_POST['FinUnits'];
$CorporateStatus = $_POST['CorporateStatus'];
$sql = "INSERT INTO General (Ticker, Ticker2, Company, Country, Sector, Industry, Competitor, Competitor2, Competitor3, Competitor4, Competitor5, Competitor6, FinUnits, Currency, Description, Index1, Index2, CorporateStatus) VALUES ('$Ticker', '$Ticker2', '$Company', '$Country', '$Sector', '$Industry', '$Competitor', '$Competitor2', '$Competitor3', '$Competitor4', '$Competitor5', '$Competitor6', '$FinUnits', '$Currency', '$Description', '$Index1', '$Index2', $CorporateStatus)";
$result = mysql_query($sql, $db) or die ('There was a problem with the query: ' . $sql . '<br>' . mysql_error());
mysql_close();
header('location:GeneralInfo.php');
?>
</body>
</html>
All the variables were defined in a previous file, and this code was working just yesterday. Today it doesn't. What's going on here?