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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.