"; pg_free_result($result); $query = " select * from cvterm where cvterm_id IN( select cvterm_id from expression_cvterm where expression_id IN( select distinct expression_id from feature_expression where feature_id IN( select subject_id from feature_relationship where object_id=".$feature_id." and type_id=38072 union select feature_id from feature where feature_id=".$feature_id." union select feature_id from feature where feature_id IN( select subject_id from feature_relationship where object_id IN (select subject_id from feature_relationship where object_id=".$feature_id." and type_id=2219) and type_id=37) and type_id=918 ) ) and cvterm_type_id=40845) and cvterm_id not in(70482,70593)"; $result = pg_query($query); if (!$result) echo('Error : ' . pg_last_error()); else{ $rows = array(); while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) { $rows[] = $line; } print json_encode($rows); pg_free_result($result); } } pg_close($dbconn); } } } ?>