RE: quotes in mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Why does the wheel need to be reinvented every second month?

The solution to this "problem" is to escape all funny characters.
Particular when it comes to quotes, the traditional solution for
this during the last 40 years has been to quote the quote. Or use
double quotes to quote singe quotes, or the other way around.

Example: I'm

1) 'I'''m' <- quote quotes (This is the safest way)
2) "I'm"   <- double quoting single quotes
3) 'I\'m'  <- Escaping (MySQL specific - don't use!) 


-----Original Message-----
From: Sudeep Sarath
To: Php-windows mailing list
Sent: 2004-04-02 10:16
Subject:  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.

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux