Esempio n. 1
0
function query($argv = '')
{
    error_reporting(7);
    $table_queryer_file = __DIR__ . DIRECTORY_SEPARATOR . 'ThinkPHP-Queryer';
    $content = file_get_contents($table_queryer_file);
    $sep = '##########################################################################';
    $arr_content = split($sep, $content);
    $sql = trim($arr_content[0]);
    connect_db($argv);
    $result = mysql_query($sql);
    $rows = array();
    if ($result) {
        $i = 0;
        while ($row = mysql_fetch_assoc($result)) {
            if ($i == 0) {
                $header = array_keys($row);
            }
            $i++;
            $rows[] = array_values($row);
        }
    }
    require __DIR__ . '/table.php';
    $in = array('header' => $header ? $header : array(), 'rows' => $rows);
    // file_put_contents('./', data);
    file_put_contents('./debug.php', var_export($in, 1));
    if ($rows) {
        $table = new table($in);
        $output = $table->render(0);
    }
    if (!$output) {
        $output = 'no results!';
    }
    exit($output);
}
Esempio n. 2
0
 public static function footer($str = '')
 {
     table::$footer = $str;
     echo table::render();
     table::$attrs = array();
     table::$datas = array();
     table::$footer = '';
 }
Esempio n. 3
0
 public static function footer()
 {
     echo table::render();
     table::$attrs = array();
     table::$datas = array();
 }