$res = $mysqli->query("SELECT n.*, c.id, c.name AS cat_name FROM news AS n LEFT JOIN categories AS c ON n.catid = c.id WHERE n.lang_id = '1'") or sqlerr(__FILE__, __LINE__, $mysqli->error);
while ($row = $res->fetch_array()) {
echo $row['id'];
}