Re: quotes in mysql
| From: | Luiz Miguel Axcar | Date: | Tue, 21 Jan 2003 03:47:22 +0000 |
| Subject: | Re: quotes in mysql | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-23360@lists.php.net to get a copy of this message | ||
Hello,
> insert into table_name (describe) values('" . $check . "')
I think it work:
$data = addslashes ($_POST ['data']) //adding slashes before special chars
// take a look on manual to get info about get_magic_quotes_gpc () to do not
add slashes in a string with slashes
$query = "INSERT INTO table_name (field) VALUES ('$data')";
//exec query
[]'s
Luiz Miguel Axcar
lmaxcar AT yahoo DOT com DOT br
((( i ))) Campinas, São Paulo, Brasil
http://www.geocities.com/lmaxcar
PHP [enguin] never sleeps.
----- Original Message -----
From: Sudeep Sarath <sudeepfiles@yahoo.co.in>
To: Php-windows mailing list <php-windows@lists.php.net>
Sent: Friday, April 02, 2004 6:16 AM
Subject: [PHP-WIN] quotes in mysql
> Hi friends,
>
> I have a 'textarea' in my php page and i need to put the details typed in
that textarea box to my MySQL database. The content in the textarea box
is(for example) : I'm a good boy.
>
> and insert string is:
>
> insert into table_name (describe) values('" . $check . "')
>
> where check is the variable that stores the POST data of textarea. Also
the field "describe" is of a text datatype.
>
> what happens is that i can't take the content string to the database.
B'cause it contains I'm (a single quote in between I and m) which confuses
mySql that string terminates after I. Is there any solution for this problem
as we cannot tell the users "dont put quotes in textarea".
>
> ....SuDeEp...
>
> Win an evening with the Indian cricket captain: Yahoo! India Promos.