Exemple #1
0
function page_db($tablename = "")
{
    page_header("database");
    if (mysql) {
        if ($tablename) {
            flash("table {$tablename} structure");
            $res = db_query("DESC {$tablename}");
            return htmlquery_code($res);
        } else {
            flash("connecting to database");
            $res = db_query("SHOW TABLES");
            return htmlquery_code($res, "<a href=?q=db/[Tables_in_" . MYSQL_DB . "]>details</a>");
        }
    }
    if (sqlite2) {
        return htmlquery_code(db_query("SELECT * FROM users"));
    }
}
Exemple #2
0
function objects_list($table, $fields, $where, $order, $action_string)
{
    if ($where) {
        $where .= " WHERE {$where} ";
    }
    if ($order) {
        $order .= " ORDER BY {$order} ";
    }
    $res = db_query("SELECT id, {$fields} FROM {$table} {$where} {$order}");
    return htmlquery_code($res, $action_string);
}