Page 1 of 1

html in myql with php

Posted: Tue Jul 21, 2009 7:06 am
by johniem
What is the safest and most working way to store an html page in mysql batabase?

Re: html in myql with php

Posted: Tue Jul 21, 2009 7:48 am
by shiznatix
use field type "text" or one of the "blob" types depending on how much HTML there is I guess. Your question is quite vague, maybe you could explain more what you are trying to do and what part of the security you are worried about.

Re: html in myql with php

Posted: Tue Jul 21, 2009 8:03 am
by johniem
i'm using tinymce on my cms to make and store html pages..I'm passing the html code to a php script
and using mysql_real_escape_string() to escape the string with the html code. I have disabled the magic_quotes on my server but the query is not working.

Code: Select all

 
$content = mysql_real_escape_string($content);
$query = "INSERT INTO galeries (ARTICLE_ID,CONTENT) VALUES (" . $articleId . ",'" . $content . "')";
$result = mysql_query($query);
 

Re: html in myql with php

Posted: Tue Jul 21, 2009 8:16 am
by johniem
I just solve the problem...it wasn't the html document that causing the problem.
I was selecting which database i will use, inside the function and i pull it out at the begining of the script and it worked...seems weird though..

Anyway...i was always wondering the best sequence to follow, manipulating the string that contains the html code, before storing it in database. So any advice will be really nice..