function search_infoTable($chemicals)
{
    if (!database_connect()) {
        return "DB_CONNECT_FAILURE";
    }
    if (empty($chemicals)) {
        return "NO_SEARCH";
    }
    # Set up parameters of a basic chemicalSGA search
    $search = "chemicalConditions.*, chemicals.structure_pic";
    $table = "chemicalConditions, chemicals";
    #Build the where statement
    $andQueryArray = array();
    if (!empty($chemicals)) {
        array_push($andQueryArray, "chemicalConditions.chemical_name IN " . build_IN_LIST($chemicals));
    }
    //array_push($andQueryArray, build_OR($chemicals, "chemicalConditions.chemical_name='", "'"));}
    array_push($andQueryArray, 'chemicalConditions.chemical_name = chemicals.name');
    $where = build_AND($andQueryArray);
    //echo($where);
    //print $where;
    #Do the search
    $result = database_select_distinct_search($search, $table, $where);
    # Throw the results into an array
    $resultArray = array();
    while ($row = mysql_fetch_assoc($result)) {
        array_push($resultArray, $row);
    }
    #database dc
    database_disconnect();
    #return the results array
    if (count($resultArray) == 0) {
        return "EMPTY";
    }
    # Is the array empty?
    return $resultArray;
}
function search_info_GO_terms($GO_terms)
{
    if (!database_connect()) {
        return "DB_CONNECT_FAILURE";
    }
    if (empty($GO_terms)) {
        return array();
    }
    # Set up parameters
    $search = "*";
    $table = $GLOBALS['TABLE_GO_NAMES'];
    #Build the where statement
    $where = "0 = 1";
    if (!empty($GO_terms)) {
        $where = "pid IN " . build_IN_LIST($GO_terms);
    }
    #Do the search
    $result = database_select_distinct_search($search, $table, $where);
    # Throw the results into an array
    $resultArray = array();
    while ($row = mysql_fetch_assoc($result)) {
        $row["searchType"] = "GO";
        array_push($resultArray, $row);
    }
    #database dc
    database_disconnect();
    #return the results array
    if (count($resultArray) == 0) {
        return "EMPTY";
    }
    # Is the array empty?
    return $resultArray;
}
function getGeneOntologyDatabaseIDs($terms)
{
    #Connect to the database
    if (!database_connect()) {
        echo "DB_CONNECT_FAILURE";
        return false;
    }
    if (empty($terms)) {
        return array();
    }
    $search = "pid";
    $table = $GLOBALS['TABLE_GO_NAMES'];
    #Build the where statement
    $orQueryArray = array();
    if (!empty($terms)) {
        array_push($orQueryArray, "GO_name IN " . build_IN_LIST($terms));
    }
    if (!empty($terms)) {
        array_push($orQueryArray, "GO_desc IN " . build_IN_LIST($terms));
    }
    $where = build_OR($orQueryArray);
    #Do the search
    $result = database_select_distinct_search($search, $table, $where);
    # Throw the results into an array
    $resultArray = array();
    while ($row = mysql_fetch_assoc($result)) {
        array_push($resultArray, $row["pid"]);
    }
    #database dc
    database_disconnect();
    #return the results array
    #if(count($resultArray) == 0){return "EMPTY";}	# Is the array empty?
    return $resultArray;
}