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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving '\n' in mysql database disallowed -- work around?

Status
Not open for further replies.

louyesh

Programmer
Mar 30, 2006
4

Hi, Hope someone can help me :)


In my html form, I have a javascript function like this:

==================================================
function sz(t) {
var a = t.value.split("\n");
var b=1;
for(var x=0; x < a.length; x++) {
if(a[x].length >= t.cols) {
b += Math.floor( a[x].length / t.cols );
}
}
b += a.length;
if(b > 2 && b > t.rows) {
t.rows = b-2;
}
}
=============================================

where I use the '\n' to count how many rows are there.
But when I save the whole html with this function in a mysql database table, I get an error like this

=========================================
java.sql.SQLException: Syntax error or access violation, message from server: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\n' here', '2128', 1, '2007-04-24', '22:25:56', '601', '
<!-- saved from url=(00' at line 1"
===========================================

indicating that I cannot have '\n' saved in mysql database.

Is there any way I can work around to save '\n' in the database table???


Thank you in advance for anyone's help !

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top