Jump to content

[SOLVED] SQL insert statement error


karenn1

Recommended Posts

Hey everyone,

 

I have the following SQL statement that's giving me an error:

 

$sql = "INSERT INTO $db.members (title, name, initials, address, house_number, area, notes, language, epd, bank, 
		branch, account_no, cell_no, home_no, fax_no, work_no, email, username, password, authorization, 
		active, membership_status, amount, id_number, leave, emergency, pay_method, pay_freq, month_fees, maid, 
		gardener, cars, back_garden, house_number_missing, street_name_missing, street_lamp, services, security, monitor, membership, 
		dogs, cancel_code, cancel_reason, member_type, patrol, contract, commence, bonus, general_comments, sign, 
		security_no, emergency_name) 

		VALUES ('".$_POST['title']."',
				'".$_POST['name']."',
				'".$_POST['initials']."',
				'".$_POST['address']."', 
				'".$_POST['house_number']."',
				'".$result2['area']."',				
				'".$_POST['notes']."',
				'".$_POST['language']."',					
				'".$_POST['epd']."',
				'".$_POST['bank']."',
				'".$_POST['branch']."',
				'".$_POST['account_no']."',
				'".$_POST['cell_no']."',
				'".$_POST['home_no']."',
				'".$_POST['fax_no']."',
				'".$_POST['work_no']."',
				'".$_POST['email']."',
				'".$_POST['username']."',
				'".$_POST['password']."',
				'".$_POST['membership_status']."',
				'".$_POST['active']."',
				'".$_POST['membership_status']."',
				'".$_POST['amount']."',
				'".$_POST['id_number']."',
				'".$_POST['leave']."',
				'".$_POST['emergency']."',
				'".$_POST['pay_method']."',
				'".$_POST['pay_freq']."',
				'".$_POST['month_fees']."',
				'".$_POST['maid']."',
				'".$_POST['gardener']."',
				'".$_POST['cars']."',
				'".$_POST['back_garden']."',
				'".$_POST['house_number_missing']."',
				'".$_POST['street_name_missing']."',
				'".$_POST['street_lamp']."',
				'".$_POST['services']."',
				'".$_POST['security']."',
				'".$_POST['monitor']."',
				'".$_POST['membership']."',
				'".$_POST['dogs']."',
				'".$_POST['cancel_code']."',
				'".$_POST['cancel_reason']."',
				'".$_POST['member_type']."',
				'".$_POST['patrol']."',
				'".$_POST['contract']."',
				'".$_POST['commence']."',
				'".$_POST['bonus']."',
				'".$_POST['general_comments']."',
				'".$_POST['sign']."',
				'".$_POST['security_no']."',
				'".$_POST['emergency_name']."'

		)";

$result = mysql_query($sql);			

exit(header("location: success.php?type=client_add"));

 

The error I get is the following:

 

"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 'leave, emergency, pay_method, pay_freq, month_fees, maid, gardener, cars, back_g' at line 3"

 

This is driving me bananas. I can't see where the problem is. All the fields match up with the values.

 

 

Someone please help!!!?

 

Thanks!

Karen

Link to comment
https://forums.phpfreaks.com/topic/131617-solved-sql-insert-statement-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.