$query= $mysqli->query("select id, name from projects limit 5");
while($project = $query->fetch_assoc()){
$news_query = $mysqli->query("select * from news where `project_id` = {$project[id]} order by `pubdate` desc limit 5");
while($news = $news_query ->fetch_assoc()){
echo $news['title'];
}
}
$('#' + id_from_json).text(text_from_json);
$last_order = -1;
foreach($items as $item){
if($last_order != -1 && $item['order'] != $last_order)
{
echo '</div>';
}
if($item['order'] != $last_order)
{
echo '<div>';
$last_order = $item['order'];
}
echo $item['order'];
}