Hi everyone, I get this error: 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 'primary WHERE (CustID) = '1121600984'' at line 1.
when I am running this code, I have pored over this for about an hour and still cannot find where my syntax error is at.
<?php
include('config.php');
$Con = mysql_connect($Host, $Usr, $Pass);
mysql_select_db("$DB", $Con);
$PrefUsr = Usr;
$Chk = "SELECT * FROM login WHERE Usr = '$PrefUsr'";
$Result = mysql_query($Chk) or die(mysql_error());
If (mysql_num_rows($Result))
{
die("The Username that you entered is already in our system! Please try another.");
}
Else
$CustID = rand(1, 9999999999);
$MemStat = JJ;
$testID = "SELECT * FROM primary WHERE (CustID) = '$CustID'";
$IDresult = mysql_query($testID) or die(mysql_error());
;
If (mysql_num_rows($IDresult))
{
die("That Customer ID Already Exhists.");
}
Else
$primary_insert = "INSERT INTO primary(CustID) VALUES('$_POST[$CustID]')";
$login_insert = "INSERT INTO login(CustID, Usr, Pass, MemStat, Email)
VALUES('$_POST[$CustID]', '_$Post[usr]', '$_Post[Pass]', $_POST[$MemStat], '$_Post[Email])";
$basic_insert = "INSERT INTO basic(CustID, Fname, Lname, Ctry, St, City, Zip, CCAcct)
Values('$_POST[$CustID]', '$_POST[Fname]', '$_POST[Lname]',
'$_POST[Ctry]', '$_POST[st]', '$_POST[City]', '$_POST[Zip],
'$_POST[CCAcct])";
If (mysql_query($primary_insert))
{
die('Error: ' . mysql_error());
}
echo "<br />Primary Key Generated and Inserted Successfuly<br />";
If (mysql_query($login_insert))
{
die('Error: ' . mysql_error());
}
echo "<br />Login Information Collected and Inserted Successfuly<br />";
If (mysql_query($basic_insert))
{
die('Error: ' . mysql_error());
}
echo "<br />Basic Information Collected and Inserted Successfuly<br />";
mysql_close($Con);
?>
Thanks