"You have an error in your SQL syntax" - But can't
Posted: Wed May 02, 2007 11:45 am
Hello,
MySQL gives me 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 'where customers_id='14')' at line 1"
For this part of the script:
Here is the surrounding code:
I can't find any error so please help me locate it - or tell me if there isn't one so I can start to look for other errors that might cause the MySQL error.
Best Regards
Oskar R
MySQL gives me 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 'where customers_id='14')' at line 1"
For this part of the script:
Code: Select all
getaddressid="SELECT * FROM address_book where customers_id='".$newcustomer['customers_id']."'";
$rowaddressid=mysql_query($getaddressid) or die( mysql_error() );
$addressid = mysql_fetch_assoc($rowaddressid);Code: Select all
$insertaddress="INSERT INTO address_book (customers_id, entry_company, entry_firstname, entry_lastname, entry_street_address, entry_postcode, entry_city, entry_state, entry_country_id, entry_zone_id) values ('".$newcustomer['customers_id']."', '".$row->business_name."', '".$row->first_name."', '".$row->last_name."', '".$row->address_street."', '".$row->address_zip."', '".$row->address_city."', '".$row->address_state."', '".$countryid['countries_id']."', '".$stateid['zone_id']."')";
$resultaddress=mysql_query($insertaddress) or die( mysql_error() );
$getaddressid="SELECT * FROM address_book where customers_id='".$newcustomer['customers_id']."'";
$rowaddressid=mysql_query($getaddressid) or die( mysql_error() );
$addressid = mysql_fetch_assoc($rowaddressid);
$insertaddressid="INSERT INTO customers (customers_default_address_id) values ('".$addressid['address_book_id']."') where customers_id='".$newcustomer['customers_id']."')";
$resultinsertaddressid=mysql_query($insertaddressid) or die( mysql_error() );Best Regards
Oskar R