can any one help me in solving my problem!
I am using if exits statement to check weather user name , date of birth etc present in the data base or not but i am get the following error
#1064 - 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 'IF EXISTS (select NAME,SUR_NAME,DATE_OF_BIRTH,POST_CODE where NAME='$Name',SUR_N' at line 1
here is my code:
$sql="IF EXISTS (select NAME,SUR_NAME,DATE_OF_BIRTH,POST_CODE where NAME='$Name',SUR_NAME='$SurName',DATE_OF_BIRTH='$Month-$Day-$Year',POST_CODE='$postcode')
INSERT INTO `user_details`(`REGISTRATION_NUM`, `POST_CODE`, `NAME`, `SUR_NAME`, `FATHER/SPOUSE_NAME`,
`GENDER`, `DATE_OF_BIRTH`, `QUALIFICATION`, `C_DESIGNATION`, `CONTACT_ADDRESS`, `PERMANENT_ADDRESS`, `CONTACT_NUM`, `ALTERNATE_NUM`, `P_EMAIL`, `ALTERNATE_EMAIL`, `DD_NUM`, `DD_DATE`, `BRANCH/BANK`, `RECENT_PROFILE`, `OBJECTIVE`,
`ADD_DUTIES`, `ACHIEVEMENTS`, `EXTRA_CIRRICULAR_ACT`, `LANGUAGES`, `INTERESTS_HOBBIES`, `PURPOSE`, `ESSAY`, `RefName1`, `RefDesgnation1`, `RefAddress1`,
`RefContactNum1`, `RefBoard1`, `RefName2`, `RefDesignation2`, `RefAddress2`,
`RefContactNum2`, `RefBoard2`)
VALUES
(NULL, '$postcode', '$Name', '$SurName', '$Father_SpouseName',
'$Gender', '$Month-$Day-$Year', '$Qualification',
'$CurrentDesignation', '$ConctactAddress', '$PermanentAddress', '$ContactNo', '$AlternativeNo', '$Primary_Email_Id', '$Alternative_Email_Id', '$DDNo', '$DD_Date', '$BankAndBranch',
'$RecentProfile', '$Objective', '$AdditionalDuties', '$Achievements', '$ExtraCirriculars', '$Languages', '$HobiesInterests', '$Purpose', '$Essay', '$RefName1', '$RefDesignation1', '$RefAddress1', '$RefContactNo1', '$RefBoard1', '$RefName2', '$RefDesignation2', '$RefAddress2','$RefContactNo2','$RefBoard2')";