CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Storing HTML in MySQL


New User

May 8, 2008, 9:04 AM

Post #1 of 2 (176 views)
Storing HTML in MySQL Can't Post

I'm trying to store HTML in a MySQL DB via a Perl script. I'm far more fluent in PHP and I simply use the addslashes() function to "sanitize" the HTML for storage in a field. I can't seem to find an equivalent function in Perl - any ideas for a simple way to clean up the HTML code for storage and then output to a user as an HTML page?



May 8, 2008, 2:45 PM

Post #2 of 2 (175 views)
Re: [musclehead] Storing HTML in MySQL [In reply to] Can't Post

you dont need to sanitize anything with DBI, DBI does that for you already, here is a quick example:
$mark = $dbh->prepare("update movies set status=? where uniqueid=?");
$mark->execute('D', $id);

so as you see i am just placing a ? inside my query and when i execute it i am defining variables there, by doing so, DBI will autoescape your characters, and insert data into DB.

hope that helps.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives