Answer the question
In order to leave comments, you need to log in
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);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question