English 中文(简体)
维护我sql数据库中的html内容
原标题:saving html content in mysql database

我正在利用Sandkl数据库中的一些内容,并试图节省其中的一些内容。 html的内容由碎板生成。 内容就是这样。

<p><img align="left" alt="" src="images/1im1.jpg" style="margin:1px 15px 0 0; border:1px solid #cecece; " /> <img alt="If syou love hot sauce" src="images/tit_If-you-love-hot-sauce.jpg" /></p><br>D elidas is a fine<p>

I am using this in php-

$main_data = mysql_real_escape_string($_POST[ content ]);

这是在我的当地东道(xampp)工作。 但不在网上工作。 我的东道国正在使用最新版本的PHP和MySQL。 在网上数据库节省费用之后,我也看到这一点。

<p><img align="left" alt="" src="images/1im1.jpg" style="margin:1px 15px 0 0; border:1px solid #cecece; " /> <img alt="If syou love hot sauce" src="images/tit_If-you-love-hot-sauce.jpg" /></p>br>D elidas is a fine<p> 

因此,我的网页上没有正确显示超文本。 请就此帮助我。 这在引言之前增加了斜线。 我想挽救准确的html,在前面显示。

问题回答

http://php.net/manual/en/security.magicquotes.php http://php.net/manual/en/security.magicquotes.php。

你们可以在法典中加以区别,但此处的例2显示在

象您的东道方一样,它可能会有<条码>magic_quotes_gpc被转成,这将自动增加引文,并重复从_GET、_POST和_COOKIE得出的数据。

您不妨为全球化学品统一分类标签制度数据设定一个总结功能。 例如......

function mysql_escape_gpc($dirty)
{
    if (ini_get( magic_quotes_gpc ))
    {
        return $dirty;
    }
    else
    {
        return mysql_real_escape_string($dirty);
    }
}

This way your code is portable, regardless of how the server is configured.

而且,如果你的生产环境支持的话,你应考虑研究准备的发言。 这样,你就不必担心放弃你的数据,然而,如果转而使用<条码>魔法_引用_gp,你仍需要将其归罪。

当你从数据库中抽取时,你需要用超文本压缩机。 权利?

我通过在德国马克数据库中使用以下编码部分来做到这一点:

Storing into the database. You must use the following code segment in the actual mySQL Insertcall. I found out if you do this to the variable first and then put the variable in the insert call it will not work. The function must be in the mySQL statement.
mysql_real_escape_string($myValue)

Retrieving Into textbox in value. Assuming your values have been already retrieved from the database and now are in an array Called theValues. Basically I am Removing any backslashes but before hand I m making sure it can be displayed correctly using htmlentities. Since you are no Backslashes in HTML that I know of it fixes it where servers replace quotes with ". If you do encounter some Back slashes in HTML you ll just have to be a bit more clever in your replacement function.
$myValue= str_replace("\", "", htmlentities($theValues->myValue)); echo $myValue;

echoing out on to a page same reasons as above, but the htmlentities function Makes it only display the text of the HTML Instead of processing the HTML
str_replace("\", "",$myValue)





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签