Exemple #1
0
 function filter_form()
 {
     $col_name = '';
     $sql = connectDB();
     $sqlcmd = "SHOW columns from product";
     $db = $sql->prepare($sqlcmd);
     $col_list = get_column_name();
     foreach ($col_list as $a) {
         if ($a != "last updated") {
             $col_name = $col_name . '<option value="' . $a . '">' . $a . '</option>';
         }
     }
     $this->form = "\n\t\t<form method='post' action='main.php?menu_op=filter'>\n\t\t<select name='col_name'>" . $col_name . "        \n\t\t</select>\n\t\t<select name='filter_op'>\n\t\t<option value='='> = </option>\n\t\t<option value='contain'> 包含 </option>   \n\t\t<option value='>'> > </option>\n\t\t<option value='<'> < </option>              \n\t\t</select>\n\t\t<input type=text name=filter_col>\n\t\t<P><INPUT TYPE=submit name='filter_value' VALUE='查詢產品'></p>\n\t\t</form>\n\t\t";
 }
Exemple #2
0
#                             Query=Status (field 363) is Active,
#                             Select Fields=sysid,248,363,217 (sysid, MLS#, Status, LastTransDate)
#                             Num Records=Limit to 2
//$response=$rets->GetDataArray('Property','11','(363=|A)','sysid,248,363,217',2);
//var_dump($response);
//print "\n\n";
#get record where LastTransDate(fild 217) is on May 14, 2014
//$response=$rets->GetDataArray('Property','11','(363=|A),(217=2014-05-14T00:00:00-2014-05-14T23:59:59)',null,null);
//var_dump($response);
//$response=$rets->GetDataArray('Property','11','(363=|A)',null,1);
//var_dump($response);
$response = $rets->GetDataArray('Property', '11', '(248=V1037517)', null, null);
var_dump($response);
foreach ($response as $key => $value) {
    foreach ($value as $field => $row_value) {
        echo "[{$field}]" . get_column_name($field) . ":{$row_value}\n";
    }
}
print "\n\n";
# get data using full key download
# and write to file where: Resource=Property,
#                          Class=11 (XPROP),
#                          Query=Status (field 363) is Active,
#                          Select Fields=All,
#                          Num Records=Unlimited
//$rets->CreateDataFile('Property','11','(363=|A)',null,null,"data/active_listings.txt");
//print "\n\n";
# get image examples
# note: that the ids passed through are photo keys which, dependent
#       on the RETS server are not the same as the MLS#;
#       in the case of BRC the photo key is the listing SYSID
Exemple #3
0
<?php

header('Content-Type: text/html; charset=utf8');
include "DBcontent.php";
include "menu.php";
//var_dump($_REQUEST);
if (!isset($_REQUEST["menu_op"])) {
    $_REQUEST["menu_op"] = "總覽";
}
//use for test
//var_dump($_REQUEST);
//echo "<br>";
//default DB=full display
$DB_display = array("full", array());
//retrieve column names
$col_names = get_column_name();
//make menu
$menu = new menu();
//retrieve menu operation
if (isset($_GET["ID"])) {
    $menu->create_profile($_GET["ID"]);
} else {
    $menu->switchform($_REQUEST["menu_op"]);
}
function make_page($menu, $form, $DBcontent, $message)
{
    $page = "\n    <html>\n    <head>\n    <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>\n    <title>尚肯產品資料庫</title>\n    </head>\n    <body>\n    <div id='wrapper'> \n    <div id='menu' style='text-align:center'>\n    {$menu}\n    </div>\n\n    <div id='message' style='text-align:center'>\n    {$message}\n    </div>\n    \n    <div id='form' style='text-align:center'>\n    {$form}\n    </div>\n    \n    <div id='DB' style='text-align:center'>\n    {$DBcontent}\n    </div>\n    \n    </div>\n    </body>\n    </html>";
    return $page;
}
echo make_page($menu->display_menu(), $menu->form, DB_content($DB_display), $menu->message);
Exemple #4
0
function DB_content($op)
{
    $col_name = '';
    $sql = connectDB();
    switch ($op[0]) {
        case "full":
            $db = $sql->prepare('SELECT * from product');
            $db->execute();
            break;
        case "filter":
            switch ($op[1][2]) {
                case "=":
                    $sqlcmd = "SELECT * FROM product WHERE {$op[1][0]} = '{$op[1][1]}'";
                    $db = $sql->prepare($sqlcmd);
                    $db->execute();
                    break;
                case "contain":
                    $sqlcmd = "SELECT * FROM product WHERE {$op[1][0]} LIKE '%{$op[1][1]}%'";
                    $db = $sql->prepare($sqlcmd);
                    $db->execute();
                    break;
                case ">":
                    $sqlcmd = "SELECT * FROM product WHERE {$op[1][0]} > '{$op[1][1]}'";
                    $db = $sql->prepare($sqlcmd);
                    $db->execute();
                    break;
                case "<":
                    $sqlcmd = "SELECT * FROM product WHERE {$op[1][0]} < '{$op[1][1]}'";
                    $db = $sql->prepare($sqlcmd);
                    $db->execute();
                    break;
            }
            break;
    }
    $col_list = get_column_name();
    foreach ($col_list as $name) {
        $col_name = $col_name . '<th nowrap="nowrap">' . $name . '</th>';
    }
    $content = '
    <br>
    <table border=1 cellspacing="1" cellpadding="1" style="word-break:break-all" WIDTH="100%" align="center">
    <tr>
    <th>快照</th>
    ' . $col_name . '</tr>';
    while ($a = $db->fetch(PDO::FETCH_ASSOC)) {
        $content .= '<tr>';
        //load snapshot
        $b = $a['ID'] . "\\" . $a['ID'] . "_1.jpg";
        if (file_exists($b)) {
            $content .= '<td align="center">' . '<a href="main.php?ID=' . $a['ID'] . "\"><img src=\"{$a['ID']}\\{$a['ID']}_1.jpg\" HEIGHT=\"40\">";
        } else {
            $content .= '<td align="center">' . '<a href="main.php?ID=' . $a['ID'] . '" title="產品連結">產品連結</a>';
        }
        foreach ($a as $key => $c) {
            //        var_dump($a);
            if ($key == "ID" or $key == "NAME") {
                $content .= '<td align="center" nowrap="nowrap">' . $c . '</td>';
            } else {
                if ($key == "COLOR") {
                    $content .= '<td align="center" class="AutoNewline">';
                    $colors = queryColor($a["ID"]);
                    if (!empty($colors)) {
                        foreach ($colors as $c) {
                            $content .= $c . "<br>";
                        }
                    } else {
                        $content .= 'N/A';
                    }
                    $content .= '</td>';
                } else {
                    $content .= '<td align="center" class="AutoNewline">' . $c . '</td>';
                }
            }
        }
        $content .= '</tr>';
    }
    return $content;
}