-8

The following query fails:

INSERT INTO education_details SET 
    candi_qualification ='BE,BSC',
    candi_uniboard = 'kce,kce',
    candiyop = '2015,2013',
    candi_grade_cgpa = 'b,b',
    candi_specilization = 'cse,cse',
    language = 'tamil,English',
    read = 'Yes,Yes',
    write = 'Yes,Yes',
    speak = 'Yes,Yes',
    candi_id = '1'

Error message:

#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 'read='Yes,Yes',write='Yes,Yes',speak='Yes,Yes',candi_id='1'
' at line 1

Blaatpraat
  • 2,829
  • 11
  • 23
  • show error like this #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 'read='Yes,Yes',write='Yes,Yes',speak='Yes,Yes',candi_id='1'
    ' at line 1
    – Laxman palani Sep 16 '16 at 09:10
  • insert into education_details (candi_qualification,candi_uniboard,.....) values('value_to_candi_qualification ','value_to_candi_uniboard',.....) – Denny Sutedja Sep 16 '16 at 09:13
  • your query is for update sir. not insert – Denny Sutedja Sep 16 '16 at 09:13
  • the query used wont work. try this for inserting http://www.w3schools.com/php/php_mysql_insert.asp and try this for updation http://www.w3schools.com/php/php_mysql_update.asp – Tobin Thomas Sep 16 '16 at 09:14
  • @Laxman palani Use Back quote use (\`) instead of simple `read`. You have to Back quote use (\`) in all field. Try this.This will solve your issue. – Manish Sep 16 '16 at 09:16

2 Answers2

2

If your column name exists in education_details table. Then there is one mistake which i am thinking is missing Back quote use (`).

Use Back quote use (`) instead of simple read. As i also mentioned above. This mat solve your issue.

 INSERT INTO education_details SET 
            `candi_qualification` ='BE,BSC',
            `candi_uniboard` = 'kce,kce',
            `candiyop` = '2015,2013',
           `candi_grade_cgpa` = 'b,b',
            `candi_specilization` = 'cse,cse',
            `language` = 'tamil,English',
            `read` = 'Yes,Yes',
            `write` = 'Yes,Yes',
            `speak` = 'Yes,Yes',
            `candi_id` = '1'

@Laxman palani you are using read and write. In which i may be wrong but as per mysql documentation its a LOCK TYPE. please read the link http://dev.mysql.com/doc/refman/5.7/en/lock-tables.html .

By using Back quote use (`). you may get rid of this.

Manish
  • 3,443
  • 1
  • 21
  • 24
-2

Using backticks around field names

You need to use backticks around your column names (and around your table is also good practice).

Blaatpraat
  • 2,829
  • 11
  • 23