Page MenuHomec4science

getAnnotations.php
No OneTemporary

File Metadata

Created
Thu, Aug 1, 14:23

getAnnotations.php

<?php
//echo "Connecting ... <br>";
$conn = pg_connect("host=localhost port=5432 dbname=i2b2 user=shrine_ont password=demouser");
if (!$conn) {
echo "Error while connecting to the postgres database";
exit;
}
// just get the first row (which already contain all the annotations' name)
$result = pg_query($conn, "SELECT annotation_id FROM shrine_ont.genomic_annotations_metadata");
if (!$result) {
echo "An error occurred.\n";
exit;
}
// json format
$annotationNames = "[";
while ($row = pg_fetch_row($result)) {
$annotationNames .= "\"$row[0]\",";
}
// drop the last comma
echo substr($annotationNames, 0, -1) . "]";

Event Timeline