Example #1
0
File: mysql.php Project: GMOD/Chado
function insert_if_new($table, $where, $values, $id)
{
    #use for rows that should be unique
    $result = do_select("SELECT * from {$table} WHERE {$where}");
    if ($result == 0) {
        return do_insert("INSERT INTO {$table} VALUES({$values})");
    } elseif ($result[0]['count'] == 1) {
        return $result[1][$id];
    } else {
        return false;
    }
}
    $total_size = $response['totalSize'];
    echo "{$total_size} record(s) returned<br/><br/>";
    foreach ((array) $response['records'] as $record) {
        echo $record['Id'] . ", " . $record['Name'] . "<br/>";
    }
    echo "<br/>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Longer than X Employees</title>
    </head>
    <body>
        <tt>
            <?php 
$access_token = $_SESSION['access_token'];
$instance_url = $_SESSION['instance_url'];
if (!isset($access_token) || $access_token == "") {
    die("Error - access token missing from session!");
}
if (!isset($instance_url) || $instance_url == "") {
    die("Error - instance URL missing from session!");
}
do_select($instance_url, $access_token);
?>
        </tt>
    </body>
</html>
Example #3
0
File: wiki.php Project: GMOD/Chado
function get_userid($username)
{
    global $db;
    $sql = "SELECT * FROM user WHERE user_name = '{$username}'";
    $result = do_select($sql);
    if ($result[0]['count'] > 0) {
        return $result[1]['user_id'];
    }
    return 0;
}