false, 'error' => 'Missing facture_id')); exit; } $sql = "SELECT rowid, title, line_order, parent_section FROM ".MAIN_DB_PREFIX."facture_lines_manager"; $sql .= " WHERE fk_facture = ".(int)$facture_id; $sql .= " AND line_type = 'text'"; $sql .= " ORDER BY line_order"; $resql = $db->query($sql); $textlines = array(); while ($obj = $db->fetch_object($resql)) { $textlines[] = array( 'id' => $obj->rowid, 'title' => $obj->title, 'line_order' => $obj->line_order, 'parent_section' => $obj->parent_section ); } echo json_encode(array('success' => true, 'textlines' => $textlines));