On 20-Jul-2001 garman wrote:
> I'm creating a specialized "suggestion box" type of web application in PHP. 
> I'm using MySQL for data storage.
> Whenever I try to submit text that contains a double quote character ("),
> the 
> submission gets truncated at the first occurance of a double quote and
> beyond.
>  Single quotes don't seem to be problematic.
> So if the user inputted the following text:
>     hello " my suggestion for deals with improving the...
> then only "hello" would get put in the database, and everything from the 
> double quote to the end of the input would be truncated.
> I've tried addslashes() and removeslashes() before the submit, but that 
> doesn't seem to help.

You didn't post any code, but I'll bet you're double quoting your query.

$qry="INSERT INTO da_table (foo) VALUES ('$bar')";

try :

$qry=sprintf('INSERT INTO da_table (foo) VALUES ('%s')', $bar);

on the Select / display:
 echo nl2br(htmlspecialchars(stripslashes($row->foo)));

also checkout 'set_magic_quotes_runtime()'

Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to