Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem inserting with linebreaks

Status
Not open for further replies.

kaancho12

Technical User
Feb 22, 2005
191
hi,
my sql statement looks like this:
"INSERT INTO TABLE (row1, row2, row3) VALUES ('A',
'There is a line break after this
this line wont show up in the table.
Same with this line',
'row 3 shows up fine')";

is there a way i can ignore the line breaks in the mysql when doing this type of insert so that the line breaks are converted to spaces or s.t.????
 
That depends on your programming language.

In C(++) you can break strings onto separate lines like:[tt]
"This is a one-"
"line string"[/tt]
In Perl, you can use the concatenation operator:[tt]
"This is a one-".
"line string"[/tt]
I don't know much PHP, but I'd imagine it would have something similar.
 
I think the point is not that he wants to know how to continue a line in his programming language, but that he wants to insert a string with newlines into his database.

You would have to do a search and replace on the string in your programming language. Either that or escape the newlines.
 
ericbrunson,
how do i do escape or search and replace the newlines in "java" ?
thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top