1

I know mySQL has no issue to store html tags as it is. I want to know how can I store just by escaping commas, and quotes and put HTML as it is in PHP?

To give further idea, I fetched a SQL backup and now transferring in other db by using a PHP script. The data I have in tables have HTML in original format.

Volatil3
  • 14,253
  • 38
  • 134
  • 263

2 Answers2

0

in the code below you will be putting the HTML being processed:

        ob_start();
        //rendering html

        //end of rendering html
        $html = ob_get_contents();
        ob_end_clean();
    echo $html;

        $sql = $pdo_conn->prepare("INSERT INTO processed (`id`, `html`, ) VALUES (:id, :html)");
        $sql->bindParam(':id', $id);
        $sql->bindParam(':html', $html);
        $sql->execute();
i am me
  • 89
  • 1
  • 14
0

Use htmlentities($myHtml, ENT_QUOTES) when retriving the html and Use mysqli_real_escape_string($connection,$myHtml) before inserting to database

Cr1xus
  • 427
  • 3
  • 20