473,654 Members | 3,108 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to insert "\n" in mysql using php

24 New Member
Hi Guys....

My input is something like this "c1cc(c(cc1 )I)/C=N\n1c(nnc1)S" .
You can see the "\n" in between the input. It is not a newline character as my input has that character. I want to insert the input as it is. But When I try to insert into mysql database, it's stored as two lines like the below..

c1cc(c(cc1)I)/C=N
1c(nnc1)S

I want to insert as it is!!!!!!

Datatype i used is TEXT.

Please reply with solution...
thanks in advance...
Jun 10 '08 #1
2 5974
r035198x
13,262 MVP
The backlash is a special character. You need to escape it like you do for all other special characters using another backlash.
Jun 10 '08 #2
Atli
5,058 Recognized Expert Expert
It is always best to run any text through the mysql_real_esca pe_string function before adding it to a MySQL database.

It will escape all special characters so they can be safely inserted into the database.
Jun 11 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1703
by: Thomas Reat | last post by:
The postgresql documentation claims that "on insert" rules are executed after the insert. This is not happening for me. I have a rule that is being executed even though the insert should have failed due to a foreign key check. The rule does an insert that is failing, and the whole insert fails. So in this case it's not a huge problem. But I get a completely useless error message, and as far as I can tell there is no way to determine...
2
2807
by: sm | last post by:
How to "Insert" (not append) new text segment to an existing text file? Assume that we have text file as shown below; Elvis Sofia Kylix BCB--> How to insert here? Atten BuilderX Roma
4
2062
by: hao | last post by:
Hi, all When I use ASP to insert an record to a database, I got some errors and can not insert any value with Chinese Char. The only way I can do that is use "rst1.Addnew...rst1.update". Anyone know why? thx
2
1914
by: Marlon Brown | last post by:
Hello, I am able to "edit" and "update" records using Gridview and Data Sources. However I don't see an option to "insert" records. Can someone tell me what's the procedure to "insert" records from ASP.NET - SQL db using Gridview ?
20
18342
by: Mark Harrison | last post by:
So I have some data that I want to put into a table. If the row already exists (as defined by the primary key), I would like to update the row. Otherwise, I would like to insert the row. I've been doing something like delete from foo where name = 'xx'; insert into foo values('xx',1,2,...);
3
5152
by: mahajanvit | last post by:
Hi one and all I got this problem during my project. So in order to solve this I made a very small application. I am trying to insert using SP and sqldatasource control. I know that while using sqldatasource control, there is no need of opening and closing a connection. Also there is no need to write connection string. When i am selecting table from sqldatasource and writing insert statement in C# code, its working fine. When I am...
1
3987
by: oanhhuynh | last post by:
Hi, I'm designing 1 form include 2 Unbound Object Frame to insert image and memo that describe the product. On database in Access have 2 fields image and description with OLE Object property Code on form is : dim strinsert2 strInsert2 = " INSERT INTO products(image,description) values (," & Me.OLEUnbound01 & "," & Me.OLEUnbound02 & ",)"
1
1373
jhardman
by: jhardman | last post by:
I know this question deals with a lot of SQL, but I am applying it to ASP, so I think this is the best place for it. When I learned SQL, I saw the "insert" command as very useless. It tries to do so much that it often gives errors, since any part of it wrong generates an error. I always use "addnew" which allows you to add each entry on a new line. Although this may generate errors, you can easily handle the errors or use the error to...
1
4440
by: bobble | last post by:
Is there any way to insert a record as the first record in an existing table, insert using RRN =1? What I'm building are several files to be used by Excel from an iSeries using DB2. I want to add the column headings after I've built the data as I will know the headings based on the system catalog syscolumns for the files I have built. I'm using Views that I build on the fly and all that is wroking fine I just need to figure out how to add the...
0
8372
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8285
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8814
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8706
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8591
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7304
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5621
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1915
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.