SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast katieB's Avatar
    Join Date
    May 2010
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help! I'm stuck in a query and can't get out!

    I have read so many of the SitePoint books but am brand new to the Forum. I'm trying to teach myself about databases and PHP. I am going through "Build Your Own Database Driven Website with PHP and MySQL" and have created the joke table. I presently am in an INSERT command so that I can play around with the SELECT command. BUT, I have entered the command incorrectly (forgot a double quote at the beginning of the 'jokedate'), and now I don't know how to get out of my command. Here's the command as it stands and you can see how I've tried to get out of it, to no avail. I know this is a FUNDAMENTAL lack of knowledge on my part, but any help would be much appreciated because I'm quite stuck. (And please forgive the joke I entered--I'm one of those people who can't remember a joke to save their lives so I just made something up that resembled a joke!) Thanks!

    mysql> INSERT INTO joke
    -> (joketext, jokedate) VALUES (
    ->
    -> "How many people does it take to screw in a lightbulb?
    "> Ten. One to hold the bulb and nine to spin him around!",
    -> 2010-02-03");
    "> ;
    "> );
    "> exit
    "> /cINSERT INTO joke (joketext, jokedate) VALUES {;
    "> quit
    "> /quit
    ">

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,077
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    To get out just type a double quote and then enter.
    It'll probably give you error and let you start over
    Otherwise crl+c is always a good key combo to know
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Member
    Join Date
    May 2010
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just enter another double quote, you can see on the left most part of your console that there is "> indicator which means mysql console is waiting for the other pair of double quote.

  4. #4
    SitePoint Enthusiast katieB's Avatar
    Join Date
    May 2010
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, Scallio XTX and jmslouie! I knew the answer would be simple, but when you don't know, you don't know. You were a big help. Thanks for taking the time to respond.

    Katie

  5. #5
    SitePoint Enthusiast katieB's Avatar
    Join Date
    May 2010
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ScallioXTX View Post
    To get out just type a double quote and then enter.
    It'll probably give you error and let you start over
    Otherwise crl+c is always a good key combo to know
    Out of curiosity, once I typed another double quote, it gave me a new line, not a "mysql>" line, just a "->". On that line I entered control + C, which took me out of mysql entirely. Is there a command that would take me out of the present (messed up) command and let me begin the command all over, without taking me out of mysql altogether? I guess I need a good mysql reference book. And I know there are probably a lot out there. If you could also pass on a suggestion for a reference, I'd love to know it. Thanks!

  6. #6
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,077
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    It's been a while since I worked with MySQL on the command line, but if you memory serves you can get out of "->" by typing ";", i.e. terminate the command.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  7. #7
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use a single or double quote (as is the case here) and then \c to complete the current "task".

    you won't exit right out of mysql, just the problematic code.

  8. #8
    SitePoint Enthusiast katieB's Avatar
    Join Date
    May 2010
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks again to all who helped me out today. It's wonderful to know this forum exists and that its members are so generous with their knowledge. Maybe one day, far, far from now, it will be me who can enlighten someone else!


Tags for this Thread

Bookmarks

Posting Permissions

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