FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP/MySQL oddity
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
PHP/MySQL oddity [message #175480] Sat, 01 October 2011 18:14 Go to previous message
Mason Barge is currently offline  Mason Barge
Messages: 5
Registered: November 2010
Karma:
Junior Member
I've been building a form that takes default text input from a database
(PHP 5.2, MySQL 5). It's to allow a user to modify previously entered
text without rewriting the entire thing.

The database comes from user input and it handles uploading apostrophes to
the database and then downloading them into plain HTML fine. But when the
same downloaded variable is put into a text input in a form, the
apostrophe and everything after it is truncated.

Running the variable through either addslashes() or
mysql_real_escape_string() adds a backslash, but not the apostrophe!

If that's not clear, I do a SELECT query and take, say, the "info" column,
set its value to $info, and write:

<form name=...><input type=text . . . value = '<?php echo $info;?>'

Or echo the whole thing, or double quotes around the variable. I just
can't figure out how to make the apostrophe appear to save my life.

This only happens in <input type=text> where the field is VARCHAR. I also
have textarea input (i.e. <textarea . . .>$info</textarea>) that download
their value from a TEXT column but they function fine!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: OCI.DLL and libcs.dll?
Next Topic: Re: NoDQ.com > Columns > WWE Hell in a Cell Preview by TJR Staff
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Dec 01 02:50:24 GMT 2024

Total time taken to generate the page: 0.03970 seconds