Пример #1
0
function drop_all_deck()
{
    global $DECK_TABLE_NAME;
    $all_deck_ids = get_attribute_values($DECK_TABLE_NAME, "id");
    foreach ($all_deck_ids as $id) {
        $deck_table_name = get_deck_table_name($id);
        drop_table($deck_table_name);
        print_msg("drop {$deck_table_name}");
    }
}
Пример #2
0
function print_aside_deck($id)
{
    global $DECK_SINGLE_TABLE_ATTR;
    $table = get_deck_table_name($id);
    print_msg(get_deck_name_by_id($id));
    $total = print_table($table, $DECK_SINGLE_TABLE_ATTR, 'print_single_deck_table_callback');
    print_msg("total = {$total}");
}
Пример #3
0
function get_deck_all_card($id)
{
    global $DECK_SINGLE_TABLE_ATTR;
    $table = get_deck_table_name($id);
    $attr_list_str = implode(', ', $DECK_SINGLE_TABLE_ATTR);
    $query = "SELECT {$attr_list_str} FROM {$table}";
    $result = mysql_query($query);
    $num = @mysql_numrows($result);
    $all_card = array();
    $i = 0;
    while ($i < $num) {
        $card_id = "";
        $card_num = 0;
        foreach ($DECK_SINGLE_TABLE_ATTR as $attr) {
            $value = mysql_result($result, $i, $attr);
            #print_msg($value);
            if ($attr == "id") {
                $card_id = $value;
            } else {
                $card_num = $value;
            }
        }
        #print_msg($card_id);
        #print_msg($card_num);
        $id_num = array($card_id, $card_num);
        $all_card[$i] = $id_num;
        $i++;
    }
    return $all_card;
}
Пример #4
0
    die('Could not connect: ' . mysql_error());
}
@mysql_select_db($database) or die("Unable to select database");
$deck1_id = get_current_get_value("deck1");
$deck2_id = get_current_get_value("deck2");
print_compare_form($deck1_id, $deck2_id);
#echo "<div id=\"compare_table\"><div>";
#$total = print_table($DECK_TABLE_NAME, $DECK_TABLE_ATTR, 'print_deck_table_callback');
#print_msg("total = $total");
if ($deck1_id != "" && $deck2_id != "") {
    if ($deck1_id == $deck2_id) {
        print_msg("same table");
        return;
    }
    $table1 = get_deck_table_name($deck1_id);
    $table2 = get_deck_table_name($deck2_id);
    #echo "<aside class=\"left\">";
    echo "<aside>";
    print_msg($deck1_id);
    $total = print_table($table1, $DECK_SINGLE_TABLE_ATTR);
    print_msg("total = {$total}");
    echo "</aside>";
    echo "<aside>";
    print_msg($deck2_id);
    $total = print_table($table2, $DECK_SINGLE_TABLE_ATTR);
    print_msg("total = {$total}");
    echo "</aside>";
    $table1_attr = array();
    $table2_attr = array();
    $table1_attr["id"] = "id";
    $table1_attr["num"] = "num1";
Пример #5
0
<!-- <a href="../info.php">back to info</a> -->

<?php 
include "../db/login.php";
include "mysql_query.php";
include "html.php";
#include "util.php";
include "global.php";
$link = @mysql_connect("{$servername}", "{$username}", "{$password}");
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
@mysql_select_db($database) or die("Unable to select database");
if (array_key_exists("id", $_GET)) {
    $id = $_GET["id"];
    $table = get_deck_table_name($id);
    if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '{$table}'")) == 1) {
        echo "<aside>";
        print_msg($id);
        $total = print_table($table, $DECK_SINGLE_TABLE_ATTR);
        print_msg("total = {$total}");
        echo "</aside>";
    }
}
$total = print_table($DECK_TABLE_NAME, $DECK_TABLE_ATTR, 'print_deck_table_callback');
print_msg("total = {$total}");
# close
mysql_close($link);
?>

</body>