Insert HTML from TinyMCE using MeekroDB

175 Views Asked by At

I'm creating a form that has a text area that uses TinyMCE.

When the form is submitted, the form sends the information using POST to a PHP script.

In that PHP, I'm trying to store the information from the TinyMCE in a database using MeekroDB.

The thing is that MeekroDB is storing my HTML from TinyMCE this way:

enter image description here

Is there any way of storing normal HTML?

This is my code:

DB::query("INSERT INTO products (title, price, article_nr, description, adicional_info, active, sold)
          VALUES (%s, %s, %s, %s, %s, %s, %s)",
            $query_data['title'],
            $query_data['price'],
            $query_data['article_nr'],
            $query_data['description'],
            $query_data['adicional_info'],
            $query_data['active'],
            $query_data['sold']
            )

Already tried this way:

DB::query("INSERT INTO products (title, price, article_nr, description, adicional_info, active, sold)
          VALUES (%s, %s, %s, %l, %l, %s, %s)",
            $query_data['title'],
            $query_data['price'],
            $query_data['article_nr'],
            $query_data['description'],
            $query_data['adicional_info'],
            $query_data['active'],
            $query_data['sold']
            )

but it returns an error.

1

There are 1 best solutions below

0
On

Hello @Alexandre Cristo,

Meekrodb is one of the good mysql library for php. I have started my work with meekrodb just before a month.

So your answer is :

You can do by following query in #meekrodb.

// MeekroDB lets you INSERT with a very simple format. You can tell at a glance if everything is right.

$data = array(
  'name' => $name,
  'address' => $address,
  'full_description' => $full_description
)
DB::insert('mytable', $data);

So this is the solution for html source insert into db using meekrodb library. I have done it many times for html source insert into database.