Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: wrong syntax

  1. #1
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts

    wrong syntax

    I tried to executed the below code, but something is wrong, Can somebody tell me what's wrong?

    PHP Code:
    INSERT INTO country VALUES (1'AE');
    INSERT INTO country VALUES (2'AF');
    INSERT INTO country VALUES (3'AG'); 

  • #2
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts
    when ever i do an insert i first define which fields the data is going to be written to. Like this...
    Code:
    INSERT INTO country (id, country) VALUES (1, 'AE'); 
    INSERT INTO country (id, country) VALUES (2, 'AF'); 
    INSERT INTO country (id, country) VALUES (3, 'AG');

  • #3
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts
    error:

    Code:
    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 '; INSERT INTO country (id, country) VALUES (6, 'AL')' at line 1
    Last edited by urgido; 08-23-2006 at 09:59 PM.

  • #4
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts
    is bm60_staaten the name of ur table where all the countries are stored???

  • #5
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts
    did it enter the values before this into the db if so i could be a problem with that specific INSERT statement????

  • #6
    Regular Coder
    Join Date
    Jun 2005
    Posts
    804
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Are you sending all three queries through one PHP mysql_query() call, by chance?

  • #7
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts
    sorry I edit and save the changes. The name is Country the other name is based on helo in other forum. hehehe


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •