Exemplo n.º 1
0
function create_table($id, $link)
{
    global $dbtables, $memtables, $dbencoding, $mysqlprefix;
    if (!isset($dbtables[$id])) {
        show_install_err("Unknown table: {$id}, " . mysql_error($link));
    }
    $query = "CREATE TABLE {$id}\n" . "(\n";
    foreach ($dbtables[$id] as $k => $v) {
        $query .= "\t{$k} {$v},\n";
    }
    $query = preg_replace("/,\n\$/", "", $query);
    $query .= ") charset {$dbencoding}";
    if (in_array($id, $memtables)) {
        $query .= " ENGINE=MEMORY";
    } else {
        $query .= " ENGINE=InnoDb";
    }
    mysql_query($query, $link) or show_install_err(' Query failed: ' . mysql_error($link));
    if ($id == "{$mysqlprefix}chatoperator") {
        create_operator_("admin", "", "", "Administrator", "Administrator", "", $link);
    } else {
        if ($id == "{$mysqlprefix}chatrevision") {
            perform_query("INSERT INTO {$mysqlprefix}chatrevision VALUES (1)", $link);
        }
    }
}
Exemplo n.º 2
0
function runsql($query, $link)
{
    $res = mysql_query($query, $link) or show_install_err(' Query failed: ' . mysql_error($link));
    return $res;
}