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 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2012
    Posts
    99
    Thanks
    16
    Thanked 0 Times in 0 Posts

    Question Script only creating one entry in the db table

    Hi, I have a large number of fish to add to a database, so thought just editing a .sql backup file with the commonName filled in for each species would work.

    So this is what I have

    Code:
    INSERT INTO `species` (`username`, `email`, `speciesName`, `commonName`, `scientificName`, `synonym1`, `origin`, `size1`, `environment`, `waterChemistry`, `temperature`, `feeding`, `sexing`, `compatability`, `temperament`, `breeding`, 	`comments`, `photo`, `rewards`) VALUES
    ('','','','afra Cichlid','','','','','','','','','','','','','','','');
    ('','','','african Butterfly Cichlid','','','','','','','','','','','','','','','');
    ('','','','agazzis Dwarf Cichlid','','','','','','','','','','','','','','','');
    ('','','','aulonocara Maulana','','','','','','','','','','','','','','','');
    ('','','','aulonocara Benga','','','','','','','','','','','','','','','');
    ('','','','azureus Cichlid','','','','','','','','','','','','','','','');
    ('','','','blue Discus','','','','','','','','','','','','','','','');
    ('','','','blue Acara','','','','','','','','','','','','','','','');
    Now when I run the script, the table is created and the afra cichlid is created in row 1. However an error appears

    Error
    SQL query:

    (

    '', '', '', 'african Butterfly Cichlid', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''
    );

    MySQL said: Documentation

    #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 ''','','','african Butterfly Cichlid','','','','','','','','','','','','','','','' at line 1

    I cant work out why the rest of the information is not written to the db table. Please help!

  • #2
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    721
    Thanks
    20
    Thanked 84 Times in 84 Posts
    it should be a comma not a semi-colon at the end of each entry

    Code:
    ('','','','afra Cichlid','','','','','','','','','','','','','','','');
    ('','','','african Butterfly Cichlid','','','','','','','','','','','','','','','');
    Code:
    ('','','','afra Cichlid','','','','','','','','','','','','','','',''),
    ('','','','african Butterfly Cichlid','','','','','','','','','','','','','','',''),
    There are 10 types of people on CodingForums,
    Those who understand Binary and those who dont.
    Get Cloud Hosting now from only£59 / month

  • Users who have thanked Arcticwarrio for this post:

    aquaman (06-27-2013)

  • #3
    New Coder
    Join Date
    Oct 2012
    Posts
    99
    Thanks
    16
    Thanked 0 Times in 0 Posts
    Thankyou, its always something so simple lol


  •  

    Posting Permissions

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