Inserting HTML into Mysql Database
Posted: Sun May 09, 2010 4:10 pm
Hi everyone,
Could really do with some help on this as I'm quite confused.
I want to insert HTML from a within textarea tags in a form into a mysql database. I've tried mysql_escape_string() and addslashes() but I'm still getting an error.
The variables $content, $questions and $marking_guide contain the HTML and text as well.
Here's the code:
Could someone please help? Thanks in advance!
Could really do with some help on this as I'm quite confused.
I want to insert HTML from a within textarea tags in a form into a mysql database. I've tried mysql_escape_string() and addslashes() but I'm still getting an error.
The variables $content, $questions and $marking_guide contain the HTML and text as well.
Here's the code:
Code: Select all
$content = addslashes($content);
$questions = addslashes($questions);
$marking_guide = addslashes($marking_guide);
$title = addslashes($title);
$update = "UPDATE `tablename` SET
title='$title'
content='$content',
questions='$questions',
questions_num='$questions_num',
marking_guide='$marking_guide'
WHERE lesson='$lesson' AND year='$year' AND number='$number'";
$res = mysql_query($update) or die(mysql_error());