UPDATE syntax dummy question...
Howdy, I'm trying to perform an update on a php poll table. Here is the table description: mysql describe vbooth_data; +-+--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +-+--+--+-+-+---+ | pollID | int(11) | | | 0 | | | optionText | char(50) | | | | | | optionCount | int(11) | | | 0 | | | voteID | int(11) | | | 0 | | +-+--+--+-+-+---+ 4 rows in set (0.00 sec) And here is my update query: update vbooth_data set optionText='Not at all, I'm waiting for the other shoe to drop' where (pollID='34' AND voteID='3'); When I hit Enter, it gives me this prompt: ' And nothing I input will do anything. I end up having to exit with CTRL-C or CTRL-D. I know this is probably a simple syntax issue, but what am I doing wrong?? And what is mysql looking for with that ' prompt? Thanks! Matthias - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: UPDATE syntax dummy question...
Hi, You should escape quotes within strings: Matthias Trevarthan wrote: Howdy, I'm trying to perform an update on a php poll table. Here is the table description: mysql describe vbooth_data; +-+--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +-+--+--+-+-+---+ | pollID | int(11) | | | 0 | | | optionText | char(50) | | | | | | optionCount | int(11) | | | 0 | | | voteID | int(11) | | | 0 | | +-+--+--+-+-+---+ 4 rows in set (0.00 sec) And here is my update query: update vbooth_data set optionText='Not at all, I'm waiting for the other shoe to drop' where (pollID='34' AND voteID='3'); update vbooth_data set optionText='Not at all, I\'m waiting for the other shoe to drop' where (pollID='34' AND voteID='3'); When I hit Enter, it gives me this prompt: ' And nothing I input will do anything. I end up having to exit with CTRL-C or CTRL-D. I know this is probably a simple syntax issue, but what am I doing wrong?? And what is mysql looking for with that ' prompt? Thanks! Matthias Regards -- Joseph Bueno - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: UPDATE syntax dummy question...
Matthias, MySQL is letting you know that you have an unterminated string with the apostrophe. You'll have to either use double quotes to contain the string Not at all, I'm waiting for the other shoe to drop, or escape the apostrophe in the word I'm. i.e. UPDATE vbooth_data SET optionText=Not at all, I'm waiting for the other shoe to drop WHERE (pollID='34' AND voteID='3'); Or UPDATE vbooth_data SET optionText='Not at all, I\'m waiting for the other shoe to drop' WHERE (pollID='34' AND voteID='3'); HTH, Bryant Hester Juxtapose, inc. -Original Message- From: Matthias Trevarthan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 03, 2002 9:31 AM To: [EMAIL PROTECTED] Subject: UPDATE syntax dummy question... Howdy, I'm trying to perform an update on a php poll table. Here is the table description: mysql describe vbooth_data; +-+--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +-+--+--+-+-+---+ | pollID | int(11) | | | 0 | | | optionText | char(50) | | | | | | optionCount | int(11) | | | 0 | | | voteID | int(11) | | | 0 | | +-+--+--+-+-+---+ 4 rows in set (0.00 sec) And here is my update query: update vbooth_data set optionText='Not at all, I'm waiting for the other shoe to drop' where (pollID='34' AND voteID='3'); When I hit Enter, it gives me this prompt: ' And nothing I input will do anything. I end up having to exit with CTRL-C or CTRL-D. I know this is probably a simple syntax issue, but what am I doing wrong?? And what is mysql looking for with that ' prompt? Thanks! Matthias - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: UPDATE syntax dummy question...
You need to escape the ' mark in your string. The query should be: update vbooth_data set optionText='Not at all, I''m waiting for the other shoe to drop' where (pollID=34 AND voteID=3); Note the '' within the string: the first tick escapes the second one. If you're more comfortable with C-style escaping, you can use \' instead (but this isn't so portable). Also, you shouldn't really be specifying your pollID and voteID as strings: take out the tick marks around those. Otherwise you're adding pointless (albeit small) load for the server to cast the string to an int. -Chris On Tue, 2002-09-03 at 10:31, Matthias Trevarthan wrote: Howdy, I'm trying to perform an update on a php poll table. Here is the table description: mysql describe vbooth_data; +-+--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +-+--+--+-+-+---+ | pollID | int(11) | | | 0 | | | optionText | char(50) | | | | | | optionCount | int(11) | | | 0 | | | voteID | int(11) | | | 0 | | +-+--+--+-+-+---+ 4 rows in set (0.00 sec) And here is my update query: update vbooth_data set optionText='Not at all, I'm waiting for the other shoe to drop' where (pollID='34' AND voteID='3'); When I hit Enter, it gives me this prompt: ' And nothing I input will do anything. I end up having to exit with CTRL-C or CTRL-D. I know this is probably a simple syntax issue, but what am I doing wrong?? And what is mysql looking for with that ' prompt? Thanks! Matthias - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: UPDATE syntax dummy question...
Howdy Matthias, update vbooth_data set optionText='Not at all, I'm waiting for the other shoe to drop' where (pollID='34' AND voteID='3'); When I hit Enter, it gives me this prompt: ' Two things: 1 (the ) is because it is waiting for the end of the string - you have an apostrophe opening the optionText string, then another one to 'end' it before WHERE, but there's a problem with the I'm apostrophe four words into the string! 2 both columns in the WHERE clause are integers, so neither value needs to be quoted. Regards, =dn List bait: SQL - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: UPDATE syntax dummy question...
Thanks everyone! I see that I need double quotes now. I received about 12 different personal emails from various people with exactly the same answer. Thanks again! On Tuesday 03 September 2002 10:31, Matthias Trevarthan wrote: Howdy, I'm trying to perform an update on a php poll table. Here is the table description: mysql describe vbooth_data; +-+--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +-+--+--+-+-+---+ | pollID | int(11) | | | 0 | | | optionText | char(50) | | | | | | optionCount | int(11) | | | 0 | | | voteID | int(11) | | | 0 | | +-+--+--+-+-+---+ 4 rows in set (0.00 sec) And here is my update query: update vbooth_data set optionText='Not at all, I'm waiting for the other shoe to drop' where (pollID='34' AND voteID='3'); When I hit Enter, it gives me this prompt: ' And nothing I input will do anything. I end up having to exit with CTRL-C or CTRL-D. I know this is probably a simple syntax issue, but what am I doing wrong?? And what is mysql looking for with that ' prompt? Thanks! Matthias - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: UPDATE syntax dummy question...
On Tue, 2002-09-03 at 16:31, Matthias Trevarthan wrote: And here is my update query: update vbooth_data set optionText='Not at all, I'm waiting for the other shoe to drop' where (pollID='34' AND voteID='3'); When I hit Enter, it gives me this prompt: ' This prompt indicates you did not close the '' signs, IMHO the ' in I'm is causing the problem, sql must think your command ends after the I. I think you can simply escape the ' with something like \'. HTH p.s. you will find the explanation of the different prompts in point 3.2 of the Mysql manual... -- # Mertens Bram M8ram [EMAIL PROTECTED] Linux User #249103 # # Red Hat Linux 7.3 KDE 3.0.0-10 kernel 2.4.18-3 i686 128MB RAM # - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php