Does anyone know how to store text containing html code into a blob field in a mysql database?
It doesn’t matter what you store text or html - same way.
Why do you want to store it in a BLOB? Use a text field
Sean
In my sql I say
$sql= " INSERT INTO adds
SET ADDTEXT = '$buffer',
ADDDATE = CURDATE() ";
if (!@mysql_query($sql)) {
echo("<p> Record not added" .mysql_error() .
"</p>");
exit();
}
Because $buffer contains htlm characters I am
getting a parse error.
Try adding some slashes
$slashedBuffer = AddSlashes($buffer);
$sql= " INSERT INTO adds
SET ADDTEXT = '$slashedBuffer',
ADDDATE = CURDATE() ";
if (!@mysql_query($sql)) {
echo("<p> Record not added" .mysql_error() .
"</p>");
exit();
}
Thank you for response.
Is Addslashes a PHP function or is it a subroutine? Where can I get information concerning addslashes?
Originally posted by seanf
Why do you want to store it in a BLOB? Use a text field
as far as i know, it shouldn’t really matter. yes, i would suggest using TEXT too, for consistency. but BLOB shouldn’t hurt anything. actually, i’m not sure if storing binary data in a TEXT column would hurt anything either.
You many want to use a method other than addslashes() for escaping SQL strings. See http://www.sitepointforums.com/showthread.php?s=&threadid=43061.
- Marshall
The addslashes worked just fine for my application. I did not have to use stripslashes to get the data back in a form that I needed but I am not through yet. I will need to put the reteived data into an html page.
Thanks for the help.