Re: Re[2]: Line Breaks Problem (\r\n) in Query
Andrew, you can tell the answer from Brent's info (not obvious in your mail, as you put your new text above the quote): Am Di, den 05.04.2005 schrieb Andrew um 18:05: > Hello Brent, > >Thanks for reply. > >But I would like to know if we have desired behavior in latest >versions of MySQL or it is a bug. > > -- > Best regards, > Andrewmailto:[EMAIL PROTECTED] > > Tuesday, April 5, 2005, 11:46:57 AM, you wrote: > > BB> I'm not sure what may have changed, but what you are searching on is > BB> really a partial value of a field. You wouldn't normally think of \r\n > BB> as characters, but they are are, just like a or b. > BB> Whenever you are searching on a partial value, you should use LIKE and > BB> %. > BB> SELECT * FROM table_name WHERE column_name LIKE 'value%'; As '\r\n' are characters, and you yourself wrote you store them in your data, it is correct that MySQL does not return data for your "equals" query: 'value' = 'value\r\n' MUST return "false". To get that row returned, 1) either use "LIKE" (as Brent proposed), or 2) include the '\r\n' in the string you search for, or 3) modify your data so that trailing control characters are not stored. IMO, 3) might be the best way, depending on your application's neds. HTH, Joerg -- Joerg Bruehe, Senior Production Engineer MySQL AB, www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re[2]: Line Breaks Problem (\r\n) in Query
Hello Brent, Thanks for reply. But I would like to know if we have desired behavior in latest versions of MySQL or it is a bug. -- Best regards, Andrewmailto:[EMAIL PROTECTED] Tuesday, April 5, 2005, 11:46:57 AM, you wrote: BB> I'm not sure what may have changed, but what you are searching on is BB> really a partial value of a field. You wouldn't normally think of \r\n BB> as characters, but they are are, just like a or b. BB> Whenever you are searching on a partial value, you should use LIKE and BB> %. BB> SELECT * FROM table_name WHERE column_name LIKE 'value%'; BB> You won't have to change any of your indexes or table structures, your BB> indexes will still be used for a fast search. BB> On Apr 5, 2005, at 9:18 AM, [EMAIL PROTECTED] wrote: >> Hello, >> I recall this problem again. No answer still. If I need to talk to >> other list(probably internals) just let me know. >> >> - >> I would like to describe the following problem and get an opinion >> from list members. >> >> I have simple table like >> describe table_name; >> >> +-+--+--+-+- >> ++ >> | Field | Type | Null | Key | Default | >> Extra | >> >> +-+--+--+-+- >> ++ >> | table_name_id | int(10) unsigned | | PRI | NULL | >> auto_increment | >> | column_name | varchar(30) | | | | >> | >> >> +-+--+--+-+- >> ++ >> >> My table values contains line breaks ('\r\n'). >> For example I have 1 row with 'value\r\n' in 'column_name'. >> >> SELECT HEX(column_name)FROM table_name; >> will return >> 76616C75650D0A >> >> I'm running the following query (I want to get records and DO NOT >> use '\r\n' im my WHERE clause) >> SELECT * FROM table_name WHERE column_name='value'; >> >> On MySQL Ver 11.18 Distrib 3.23.55 that query returns 1 row, >> on MySQL Ver 14.7 Distrib 4.1.9 empty set is return. >> >> I did not found anything in change log files about that difference. >> >> So, I wonder if behavior of newer MySQL version is feature or bug or >> bug fix. What is correct? >> >> Thanks! >> >> -- >> Andrew Bidochko >> >> >> -- >> MySQL General Mailing List >> For list archives: http://lists.mysql.com/mysql >> To unsubscribe: >> http://lists.mysql.com/[EMAIL PROTECTED] >> >> -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Line Breaks Problem (\r\n) in Query
I'm not sure what may have changed, but what you are searching on is really a partial value of a field. You wouldn't normally think of \r\n as characters, but they are are, just like a or b. Whenever you are searching on a partial value, you should use LIKE and %. SELECT * FROM table_name WHERE column_name LIKE 'value%'; You won't have to change any of your indexes or table structures, your indexes will still be used for a fast search. On Apr 5, 2005, at 9:18 AM, [EMAIL PROTECTED] wrote: Hello, I recall this problem again. No answer still. If I need to talk to other list(probably internals) just let me know. - I would like to describe the following problem and get an opinion from list members. I have simple table like describe table_name; +-+--+--+-+- ++ | Field | Type | Null | Key | Default | Extra | +-+--+--+-+- ++ | table_name_id | int(10) unsigned | | PRI | NULL| auto_increment | | column_name | varchar(30) | | | | | +-+--+--+-+- ++ My table values contains line breaks ('\r\n'). For example I have 1 row with 'value\r\n' in 'column_name'. SELECT HEX(column_name)FROM table_name; will return 76616C75650D0A I'm running the following query (I want to get records and DO NOT use '\r\n' im my WHERE clause) SELECT * FROM table_name WHERE column_name='value'; On MySQL Ver 11.18 Distrib 3.23.55 that query returns 1 row, on MySQL Ver 14.7 Distrib 4.1.9 empty set is return. I did not found anything in change log files about that difference. So, I wonder if behavior of newer MySQL version is feature or bug or bug fix. What is correct? Thanks! -- Andrew Bidochko -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Line Breaks Problem (\r\n) in Query
Hello, I recall this problem again. No answer still. If I need to talk to other list(probably internals) just let me know. - I would like to describe the following problem and get an opinion from list members. I have simple table like describe table_name; +-+--+--+-+-++ | Field | Type | Null | Key | Default | Extra | +-+--+--+-+-++ | table_name_id | int(10) unsigned | | PRI | NULL| auto_increment | | column_name | varchar(30) | | | | | +-+--+--+-+-++ My table values contains line breaks ('\r\n'). For example I have 1 row with 'value\r\n' in 'column_name'. SELECT HEX(column_name)FROM table_name; will return 76616C75650D0A I'm running the following query (I want to get records and DO NOT use '\r\n' im my WHERE clause) SELECT * FROM table_name WHERE column_name='value'; On MySQL Ver 11.18 Distrib 3.23.55 that query returns 1 row, on MySQL Ver 14.7 Distrib 4.1.9 empty set is return. I did not found anything in change log files about that difference. So, I wonder if behavior of newer MySQL version is feature or bug or bug fix. What is correct? Thanks! -- Andrew Bidochko -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Line Breaks Problem
Hello, I would like to describe the following problem and get an opinien from list members. My database values contains line breaks ('\r\n'). For example I have 1 row with 'value\r\n' in 'column_name'. SELECT HEX(column_name)FROM table_name; will return 76616C75650D0A I'm running the following query (I want to get records and DO NOT use '\r\n' im my WHERE clause) SELECT * FROM table_name WHERE column_name='value'; On MySQL Ver 11.18 Distrib 3.23.55 that query returns 1 row, on MySQL Ver 14.7 Distrib 4.1.9 empty set is return. I did not found anything in change log files about that difference. So, I wonder if behavior of newer MySQL version is feature or bug or bug fix. What is correct? Thanks! -- Best regards, Andrew Bidochko -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: How do you create ascii line breaks
Daniel Crompton wrote: How do you create ascii line breaks in a text paragraph in mysql?. When displaying text taken from a mysql row it displays it all as a flowing paragraph ie sdf sdfgfj fgjhgfh fgj fgj hfj hj hg gh hgk ghk gj gh kg k hg hg jh j fgj fg When i need to look like sdf sdfgfj fgjhgfh fgj fgj hfj hj hg gh hgk ghk gj gh kg k hg hg jh j fgj fg I am dispalying it in a webbrowser using the below code which will convert ascii line breaks into HTML tags. but i am unsure how to put in the ascii line breaks into mysql. The string you are storing in the text field must have the line feeds in it before it is quoted and saved. How they get there depends on the language you are using to generate the data. This is not a MySQL question. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
How do you create ascii line breaks
How do you create ascii line breaks in a text paragraph in mysql?. When displaying text taken from a mysql row it displays it all as a flowing paragraph ie sdf sdfgfj fgjhgfh fgj fgj hfj hj hg gh hgk ghk gj gh kg k hg hg jh j fgj fg When i need to look like sdf sdfgfj fgjhgfh fgj fgj hfj hj hg gh hgk ghk gj gh kg k hg hg jh j fgj fg I am dispalying it in a webbrowser using the below code which will convert ascii line breaks into HTML tags. but i am unsure how to put in the ascii line breaks into mysql.
Re: line breaks
Tarik, > - what is the stored character code of the enter key in the text field, i am > figuring out to find that character and replace it with the element, > for the exact display, The character is "\n" (the new line character). If you use PHP and have magic_quotes=on in your php.ini, PHP will automatically escape certain characters like \n. If magic_quotes=off, you can use the addslashes() function to accomplish this. When retrieving the data out of MySQL to display them in a textarea field once again, you have to do nothing. The web browser will take care of converting \n into something the operating thinks is a new line (Unix: \n, Windows: \r\n, MacOS: \r). If you want to display the data outside of form fields, you will have to convert \n into something HTML knows is a new line. HTML uses for example or for this. In PHP, you can use the nl2br() function that will convert \n into . If you don't use PHP, things might be a bit more complicated. Regards, -- Stefan Hinz <[EMAIL PROTECTED]> Geschäftsführer / CEO iConnect GmbH <http://iConnect.de> Heesestr. 6, 12169 Berlin (Germany) Tel: +49 30 7970948-0 Fax: +49 30 7970948-3 - Original Message - From: "Tarik Kutluca" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, January 31, 2003 5:22 PM Subject: line breaks > Hi, > > From a web form I am collecting information to a table. On the form there is > a textarea element storing to a text field on the mysql table. Since the > textarea can hold the enter key, it's stored in to the field also, but when > i try to call that cell and display it on the web page, i see that line > breaks are ignored. But the sentences must be displayed as they are entered. > > - what is the stored character code of the enter key in the text field, i am > figuring out to find that character and replace it with the element, > for the exact display, > > - do you have a shorter way to do this? > > thank you > > > - > 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: line breaks
Hi. In which way is this a MySQL related problem? Please choose a more appropriate forum next time. On Fri 2003-01-31 at 18:22:50 +0200, [EMAIL PROTECTED] wrote: > Hi, > > >From a web form I am collecting information to a table. On the form there is > a textarea element storing to a text field on the mysql table. Since the > textarea can hold the enter key, it's stored in to the field also, but when > i try to call that cell and display it on the web page, i see that line > breaks are ignored. But the sentences must be displayed as they are entered. > > - what is the stored character code of the enter key in the text field, i am > figuring out to find that character and replace it with the element, > for the exact display, Depends on the browser used to enter the text. Usually it's '\n' (i.e. the character with code 10 resp. hex 0x0A) > - do you have a shorter way to do this? Not really, except if you are happy with using Bye, Benjamin. -- [EMAIL PROTECTED] - 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: line breaks
On Fri, Jan 31, 2003 at 06:22:50PM +0200, Tarik Kutluca wrote: > Hi, > > >From a web form I am collecting information to a table. On the form there is > a textarea element storing to a text field on the mysql table. Since the > textarea can hold the enter key, it's stored in to the field also, but when > i try to call that cell and display it on the web page, i see that line > breaks are ignored. But the sentences must be displayed as they are entered. > > - what is the stored character code of the enter key in the text field, i am > figuring out to find that character and replace it with the element, > for the exact display, > > - do you have a shorter way to do this? When HTML agents display text, they are supposed to fold all whitespace characters (newlines, tabs, spaces) into a single space character unless the text is contained in a block. The characters that make up a new line sequence vary depending on the operating system of the client. Unix-like OSs use ASCII character code 10, Windows uses 13 followed by 10 and Macs (but likely not OS X+) use 13. If you are using PHP, just call nl2br() on the text before you display the text. Cheers! -- Zak Greant <[EMAIL PROTECTED]> | MySQL Advocate | http://zak.fooassociates.com MySQL Tip: Show the configuration options set in the server % mysqld --print-defaults My punctuality is well known. When the revolution takes place, I'll be late and I'll be shot as a traitor. --Traitor by the SugarCubes - 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
FW: line breaks
: : - what is the stored character code of the enter key in the : text field, i am : figuring out to find that character and replace it with the : element, : for the exact display, That's what's normally done. Line breaks are usually represented by "\n" escape character. So all you should do is replace all the instances of "\n" with . The following substitution will do the trick: s/\n//g; : - do you have a shorter way to do this? There's no quite shorter way, there is however a dirty way. Simply wrap the text between and tags while outputing to the browser. Sherzod sql, query - 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
line breaks
Hi, >From a web form I am collecting information to a table. On the form there is a textarea element storing to a text field on the mysql table. Since the textarea can hold the enter key, it's stored in to the field also, but when i try to call that cell and display it on the web page, i see that line breaks are ignored. But the sentences must be displayed as they are entered. - what is the stored character code of the enter key in the text field, i am figuring out to find that character and replace it with the element, for the exact display, - do you have a shorter way to do this? thank you - 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