I am new to using PHP, so please bear with me. Can someone please help my debug this SQL insert statement? It is dynamically generated from a form and is supposed to update the mySQL database which is opened prior.
Here is the generated SQL Insert statement. The slashes have been added thanks to the mysql_escape_string() function. I have also use the addslashes() function. (I have added extra line breaks to make the text easier to read. Also, all information is made up. It should be obvious, but it may be necessary to clear up some immediate questions about my problem.)
INSERT INTO customer_info (
u_customer_id, u_fname, u_lname, u_email, u_join_date,
u_join_time, u_join_ip, u_address, u_address2, u_city, u_state,
u_zip, u_country, u_phone, u_fax, u_web_plan, u_host_plan,
u_combo_plan, u_extra_features, u_domain_name,
u_domain_transfer, u_fp_ext, u_payment_plan, u_payment_amt,
u_disount_code, u_discount_price, u_active
) VALUES (
'JD030704', 'Johnnie', 'D\\\'oh', 'notme@spam.com', 03/07/2004,
14:24:19, '00.000.000.000', '321 Freeway Drive', 'Ste. 2',
'Bangkok', 'CA', '92055', 'US', '619-555-3021', '619-555-3067',
'none', 'none', 'ws05', 'Array', 'somedomainname.com', 'yes', 'no',
'ann', '680.91','none','0', 1
)
Invalid SQL Insert Query:
You have an error in your SQL syntax near
':24:19, '24.170.173.143', '321 Freeway Drive', 'Ste. 2', 'Bangkok', 'C' at line 12
Here are the field types:
u_customer_id 'JD030704' tinytext
u_fname 'Johnnie' tinytext
u_lname 'D\\\'oh' tinytext
u_email 'notme@spam.com' tinytext
u_join_date 03/07/2004 date
u_join_time 14:14:50 time
u_join_ip '00.000.000.000' varchar(20)
u_address '321 Freeway Drive' tinytext
u_address2 'Ste. 2' tinytext
u_city 'Bangkok' tinytext
u_state 'CA' varchar(50)
u_zip '92055' varchar(10)
u_country 'US' tinytext
u_phone '619-555-3021' tinytext
u_fax '619-555-3067' tinytext
u_web_plan 'none' varchar(10)
u_host_plan 'none' varchar(10)
u_combo_plan 'ws05' varchar(10)
u_extra_features 'Array' varchar(150)
u_domain_name 'somedomainname.com' tinytext
u_domain_transfer 'yes' tinyint(1)
u_fp_ext 'no' tinyint(1)
u_payment_plan 'ann' varchar(5)
u_payment_amt '680.91' decimal(7,2)
u_disount_code 'none' varchar(55)
u_discount_price '0' decimal(8,2)
u_active 1 tinyint(1)