html in myql with php
Moderator: General Moderators
html in myql with php
What is the safest and most working way to store an html page in mysql batabase?
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
Re: html in myql with php
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
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.
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
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..
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..