473,395 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

cant get text into the DB

25
Hi,
Im having a lot of trouble with an INSERT into a DB, and I think its because the big hunk-o-text I want to insert contains the QUOTE characters.
This one --> " <-- (Ascii(22)).

I will be inseerting the body text of emails, so it's likely that this will occur often.
Could the occourence of these characters in the text I want to INSERT screw up the operation?
The other values have the quote symbol around them, so I assume that instances of quote chars in the text I want to insert are casuing the query to fail.

Is this correct logic?

If so, is there a way around this problem?

thx
Adrian
Sep 13 '06 #1
1 1501
ronverdonk
4,258 Expert 4TB
Before inserting data into the db, you should use the PHP addslashes command. http://nl2.php.net/manual/en/function.addslashes.php
string addslashes ( string str )
Returns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte).
When retrieving data from the db you then use the stripslashes command. http://nl2.php.net/manual/en/function.stripslashes.php
string stripslashes ( string str )
Returns a string with backslashes stripped off. (\' becomes ' and so on.) Double backslashes (\\) are made into a single backslash (\).
Alternately, you can use the mysql_real_escape_string command.
http://nl2.php.net/manual/en/functio...ape-string.php

See the PHP documentation for more details http://nl2.php.net/manual/en/index.php

Ronald :cool:
Sep 13 '06 #2

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

Similar topics

2
by: Tiernan | last post by:
Hey everybody. I'm verry new to PHP and MYSQL and have been working on a form that when it is submitted stores the information into a mysql database. The main problem is that i'm trying to finish...
1
by: bayouprophet | last post by:
Cant get menu script to to put linked page in the same frame. I am new to Java and I am wondering what am I doing wrong? below are my java applet file, frame.html file, and my text file and one...
3
by: Me | last post by:
Hi Folks I keep recieving the following error message when i try to bind a combobox to the value that is in a textbox. the application crashes on the following line... Me.CBoxTitle.SelectedItem...
4
by: Jake Lewis | last post by:
I have an HTML page that loads fine including the .js file <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <script...
16
by: Mike Fellows | last post by:
when i load my windows form i populate a combobox i use the code below Dim conn As New System.Data.SqlClient.SqlConnection(strConn) Dim sql As String = "AllLenders" Dim da As New...
1
by: John | last post by:
Dear, We have 2 IIS server on win2000. we use the web server for upload file from server1 IIS to server2 IIS. We can connect from IIS1 to IIS2 success but the file unable to upload with below...
0
by: vinidimple | last post by:
Hi i have a serious problem while i was working in Excel.I want to fetch columns from an excel worksheet and i need to compare it with an sql querry fields,so i tried to open an excle...
19
by: bb nicole | last post by:
Below is my search engine for job portal which jobseeker can find the job through quick search. But it cant work... Is it mysql query got problem?? Thanx.. Interface <html> <head> <title>UMS...
12
by: lalou89 | last post by:
Develop a simple text editor program. The program will show the user a menu of choices and will act according to his choice. Use functional decomposition to break the system into small functions that...
66
by: happyse27 | last post by:
Hi All, my html code is sno 1) and perl code is sno 2). a) I tried to print $filename and it cant print out the value, only blank was displayed, and the file could not be uploaded. And it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.