I
I
Ivan Damaskin2016-10-13 19:57:15
PHP
Ivan Damaskin, 2016-10-13 19:57:15

How to get data from a database with html tags in JSON object?

Hello. The database has a table with data for example articles.
id, title, text, date
The fact is that the data in text is written as news text with html tags. You need to pull them out and form a json object.
my php

$query = 'SELECT * FROM h3sq4_k2_items';
$result = mysql_query($query);

$items = array();
$arr = array();

while ($line = mysql_fetch_array($result)) {  
    $items[] = $line;
}

echo json_encode($items);
mysql_free_result($result);
mysql_close($link);

Moreover, where I wrote news titles in Russian, I get null the same thing in the text of articles where there is html code.
What I'm getting at the moment -(f01757fd427c49f7a34c1a17836110d1.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question