473,378 Members | 1,679 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,378 software developers and data experts.

Inserting and reading data from a mysql TEXT field with php!!!

1
Hello
I am trying to insert and then read some text from a textarea control, into a mysql TEXT field, with php. For that I am using simple php code for insertion of records.

But the problem is that when I am fetching back the data some blank spaces are getting appended to the value that I am getting back from the text field. Is there any solve for it?

Kindly provide some piece of code that can solve this problem. Thanks in advance.
Jun 7 '07 #1
1 1681
Ajm113
161 100+
What are you entering?

Like "This isn't my dog!"

This is a bad if you do not use stripslashes and mysql_escape_string in it. You can use real_escape, but mysql_escape_string works great for me. If its something like "This is a simple test sentance". Since it is not using a single quote it should work. This is usualy caused by your server. Its activating a anti mysql injection attack. So if you use mysql_escape_string and stripslashes in your $_POST['textarea_name']; or $_GET['textarea_name'];. You should be able to enter single quotes.

[PHP]$text = stripslashes(mysql_escape_string($_POST['textare_name']));[/PHP]

hope this helps you!
Jun 7 '07 #2

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

Similar topics

6
by: LRW | last post by:
I have an automated process which uploads a comma separated spreadsheet (csv) and inserts it into a database: $sql = "LOAD DATA INFILE '".$uploadfile."' INTO TABLE `tbl_tracking` FIELDS...
4
by: Rob | last post by:
Hey, I'm pretty new to MySQL and have a question. I've built a database locally and have inputed some information. I need to go back and update some records, specifically by taking long pieces...
4
by: phpuser32423 | last post by:
Hi all I have been searching for hours on the php website for a function that will allow me to display just the first 50 chars of a mysql text field in a results table, but i'm having no luck. I...
3
by: Ronnie | last post by:
Hi All, A newbie here having a hard time figuring out how to parse out the City, State and Zip from a text field. I have a text field called "Registration" with a size of 40. In this field...
2
by: Shelley | last post by:
Hi everyone, I am searching a way to read part of the data in the text field in a form. As the length of the field is dynamic, I can't use the left or right function. I need to read the first 2...
0
by: Pavils Jurjans | last post by:
Hello, I have a third-paty application that uses text type field in MSSQL server to store data of incoming emails (full raw sources, including headers, etc.). Since the emails come in different...
6
by: monomaniac21 | last post by:
Hi all Is there a way to insert text into a mysql text field that already has text into it; without having first to extract the existing data and append the new text to that string variable and...
1
by: J Talbot | last post by:
Hi Was wondering if anyone could help me with this problem : If I have three checkboxes with different values on a form like : <input type="checkbox" name="checkbox" value="1stValue">...
4
code green
by: code green | last post by:
I have a text field called notes in which users have typed almost anything they like. I need to find numeric data randomly inserted in there. So for example there may be a telephone number and an...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...

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.