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
    Regular Coder
    Join Date
    Mar 2005
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    insert into problem

    Error I am recieving is :
    #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 '' at line 1
    I think it's the place where phone2 should be but that is not a mandatory field so it can be blank but i don't think mysql wants to let me.
    Code:
    INSERT INTO students(organization_id, supervisor_id, fname, mi, lname, email, address1, address2, city, state, zipcode, phone1, phone2) VALUES('2', '4', 'John', 'A', 'Doe', 'john.a.doe@lmco.com', '1600 JFK Blvd', 'Suite 200', 'Philadelphia', 'PA', '19125', '215-455-8795', ''

  • #2
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    What about the closing parenthesis?

    Code:
    INSERT INTO students(organization_id, supervisor_id, fname, mi, lname, email, address1, address2, city, state, zipcode, phone1, phone2) VALUES('2', '4', 'John', 'A', 'Doe', 'john.a.doe@lmco.com', '1600 JFK Blvd', 'Suite 200', 'Philadelphia', 'PA', '19125', '215-455-8795', '')
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #3
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,633
    Thanks
    4
    Thanked 148 Times in 139 Posts
    Two other things to note

    1) Don't enclose numeric data in quotes '1' is a string, while 1 is the number 1.

    2) use NULL for the abscence of value and not and empty string ' '


  •  

    Posting Permissions

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