Results 1 to 12 of 12
  1. #1
    Full Member
    Join Date
    January 18th, 2005
    Posts
    462
    I am trying to insert data into a mysql database using the following syntax:

    insert into table (column1, column2, column3) values (name one, name two, name three);

    The command doesn't seem to like the fact that I use spaces in my values names. I used the "char" variable for the column types and I am entering text with no numbers.

    Thanks in advance,

    Core

  2. #2
    Newbie
    Join Date
    January 18th, 2005
    Posts
    2,694
    Core -How are you inserting the data - with a PHP script or are you using PHPmyAdmin (or telnet)?

  3. #3
    Full Member
    Join Date
    January 18th, 2005
    Posts
    462
    Thanks for the quick response EagleFire!


    Will the underscores show up in the output?

    Sorry, I'm a MySQL newbie!

    Core

  4. #4
    Newbie
    Join Date
    January 18th, 2005
    Posts
    2,694
    OK - I wasn't sure what you were saying the problem was.

    Core try using VARCHAR

  5. #5
    Newbie
    Join Date
    January 18th, 2005
    Posts
    2,694
    Core - sorry i deleted my post about the underscores. I'm kind of tired and thought you were saying you had spaces in the column names - not values.

  6. #6
    Full Member
    Join Date
    January 18th, 2005
    Posts
    462
    Will give it a try..

    Thanks for the quick responses!

    Core

  7. #7
    Full Member
    Join Date
    January 18th, 2005
    Posts
    462
    Eaglefire,

    How do I change the colum from char to varchar?

    Thanks,

    Core

  8. #8
    Full Member
    Join Date
    January 18th, 2005
    Posts
    462
    BTW,

    Using Telnet to access the db.

  9. #9
    Newbie
    Join Date
    January 18th, 2005
    Posts
    2,694
    use the ALTER TABLE command

  10. #10
    ABW Ambassador
    Join Date
    January 18th, 2005
    Location
    ÄúsTrálíĺ
    Posts
    1,372
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>insert into table (column1, column2, column3) values (name one, name two, name three);<HR></BLOCKQUOTE>

    insert into table (column1, column2, column3) values ('name one', 'name two', 'name three');

    you need to put quotes around the inserted data... i think it needs to be ', not " (maybe makes no difference)

  11. #11
    Newbie
    Join Date
    January 18th, 2005
    Posts
    2,694
    oops, that's right. Sorry Core. Well at least you've learned a new and useful SQL command [img]/infopop/emoticons/icon_smile.gif[/img] I'm used to Jet SQL and some things are different in MySQL.

    BTW for anyone learning any flavor of SQL I highly recommend O'Reilly SQL in a Nutshell as a reference.

    {

    [ 07-24-2002: Message edited by: eaglefire ]

    [ 07-24-2002: Message edited by: eaglefire ]

  12. #12
    Full Member
    Join Date
    January 18th, 2005
    Posts
    462
    Got It! Thanks all...

    Pete, I will be bothering you when I start on the PHP end of this! [img]/infopop/emoticons/icon_smile.gif[/img]

    Core

  13. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Help with CJ ID insert into data feed.
    By Nightfighter in forum Programming / Datafeeds / Tools
    Replies: 5
    Last Post: February 11th, 2009, 03:02 PM
  2. Php Page / Form Processing / Mysql Insert / No Page Refresh
    By Uncle Rico in forum Programming / Datafeeds / Tools
    Replies: 3
    Last Post: January 4th, 2009, 11:55 AM
  3. PHP MySQL Bulk Insert
    By popdawg in forum Programming / Datafeeds / Tools
    Replies: 4
    Last Post: March 4th, 2006, 12:25 AM

Posting Permissions

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