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
">

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!

To get out just type a double quote and then enter.
It’ll probably give you error and let you start over :slight_smile:
Otherwise crl+c is always a good key combo to know

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.

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.

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.

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!

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