Ask a Question related to PHP Bugs, Design and Development.
-
thescottydawg #1
PHP MySQL error with insert into...... Keeps not saving though sql looks fine?????
Screen Data
Country USA (1)
State zzz
Abbreviation zz
State FIPS 123
Checking records for duplicate.....Found 0 duplicate entries
INSERT INTO tblState (CountryID, StateFIPS, StateAbbr, StateName, LockID, Status, Active) VALUES ('1', '123', 'zz', 'zzz', '0', '3', '1')
Result is
Record saved as: 0
dblink is defined as
$dblink = mysql_connect("$config_host","$config_user","$conf ig_password");
Code
DuplicateSQL ="SELECT * FROM `tblState` WHERE StateName=".sqlQuotes($StateName)." AND CountryID=".sqlQuotes($CountryID);
echo "<center>Checking records for duplicate.....";
$dblink = mysql_query($DuplicateSQL);
$num_rows = mysql_num_rows($dblink);
echo "Found ".$num_rows." duplicate entries<br>\n";
if ($num_rows == 0)
{ // Begin Save
$SaveSQL1= "INSERT INTO tblState (CountryID, StateFIPS, StateAbbr, StateName, LockID, Status, Active) VALUES ";
$SaveSQL2= "(".sqlQuotes($StateCountryID).", ".sqlQuotes($StateFIPS).", ".sqlQuotes($StateAb).", ";
$SaveSQL3= sqlQuotes($StateName).", ".sqlQuotes("0").", ".sqlQuotes("3").", ".sqlQuotes("1").")";
$SaveSQL= $SaveSQL1.$SaveSQL2.$SaveSQL3;
echo $SaveSQL."<br>\n";
mysql_query($SaveSQL);
$StateID=mysql_insert_id();
echo "Result is ",$result,"<br>\n";
echo "Record saved as: ".$StateID."<br>\n";
} else
{ // Duplicate entry
echo "Duplicate found. Please revise.....</center>\n";
}
FormOpen("State", "State", "post", "", "");
Junior Member
- Join Date
- Mar 2011
- Location
- Wichita, Ks
- Posts
- 1
-
Error in insert Data into MySQL 5.0.18
I have not idea y got syntax error in my code.. Can anyone help..... B4 this i am using MS access to build the database.....later i migrate... -
HELP SQL Update syntax error in windows2003 but works fine in NT4???
We upgraded our production server to windows 2003 and have been seeing this error when trying to update the database through a cfquery tag: ODBC... -
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
When i try to start my mysql server, i get this error ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'... -
PHP/MySQL Connection fine, Bindings / testing recordsetleads to HTTP Error Code 500
Hi all, I'm having this weird problem with my MySQL-connection INSIDE Dreamweaver. The pages that I create work fine online. I have made a... -
Error on Page - Line 46 - Character 1 - but everything looks fine!?
Hi, I have a page, that is giving me a Javascript error: Line: 46 Character: 1 Error: Object Expected Code: 0 Here is line 46 on my page:



Reply With Quote

