static function OutputTestDbSearch() { $application = "vm"; // "vm", "test", "cms", "preprints" // lowercase! $stdout = ""; if (!class_exists("fromdb", FALSE)) { require_once PATH_CLASSES . "/fromdb.php"; } if (isset($GLOBALS["DBS"][$application])) { $dbClass = new fromdb($GLOBALS["DBS"][$application]["name"], $GLOBALS["DBS"][$application]["host"], $GLOBALS["DBS"][$application]["user"], $GLOBALS["DBS"][$application]["pass"], FALSE); } else { return "***ERROR***"; } // -------------------- // -- Test total output form one table at a time: //$table = "abs_apartments"; //$table = "abs_events"; //$table = "abs_expenses"; //$table = "abs_leases"; //$table = "abs_offices"; //$table = "abs_payment"; //$table = "abs_visits"; //$table = "jam_applicants"; //$table = "jam_documents"; //$table = "jam_posfields"; //$table = "jam_positions"; //$table = "jam_recommendations"; //$table = "jam_reviews"; //$table = "jam_rf"; //$table = "lic_event"; //$table = "lic_host"; //$table = "lic_server"; //$table = "lic_soft"; //$table = "lic_user"; //$table = "wiw_trips"; //$table = "zzz_avatars"; //$table = "zzz_bugs"; //$table = "zzz_countries"; //$table = "zzz_flavors"; //$table = "zzz_huts"; $table = "zzz_list_members"; //$table = "zzz_lists"; //$table = "zzz_logs"; //$table = "zzz_master"; //$table = "zzz_templates"; //$table = "zzz_unit_members"; //$table = "zzz_units"; $sql = "SELECT " . " * " . "FROM " . " " . $table . " " . "WHERE " . " (lm_lid = '40213') " . ""; // -------------------- // -- Test a special case: /* $sql = "SELECT " . " lm_lid, " . " lm_key," . " lm_value " . "FROM " . " zzz_list_members " . "WHERE " . " (lm_lid = '40213') " . " AND (lm_id <> '41135') " . ""; */ // -------------------- $res = $dbClass->query($sql, FALSE); $eventlist = array(); if ($dbClass->num_rows($res)) { $stdout .= "<h2>" . $table . "</h2>\r\n"; while ($record = $dbClass->next_record_assoc($res)) { ksort($record); $stdout .= "<br><br><hr>\r\n"; foreach ($record as $idx => $value) { $stdout .= "<br>[" . $idx . "] = <strong>" . $value . "</strong>\r\n"; } } // end while } // -------------------- return $stdout; }
public static function AdbMypearLists() { $stdout = ""; $records = array(); if (!class_exists("fromdb", FALSE)) { require_once PATH_CLASSES . "/fromdb.php"; } $db = new fromdb($GLOBALS["DBS"]["vm"]["name"], $GLOBALS["DBS"]["vm"]["host"], $GLOBALS["DBS"]["vm"]["user"], $GLOBALS["DBS"]["vm"]["pass"]); // -------------- $tables = array("zzz_units" => "u", "zzz_lists" => "l"); foreach ($tables as $table => $prefix) { $sql = "SELECT * FROM " . $table; $result = $db->query($sql); if ($db->num_rows($result) > 0) { while ($rec = $db->next_record_assoc($result)) { if (isset($rec[$prefix . "_name"]) && isset($rec[$prefix . "_class"])) { $records[$table . " --> " . $rec[$prefix . "_name"] . " [" . $rec[$prefix . "_class"] . "]"][] = array("id" => $rec[$prefix . "_id"], "parent" => $rec[$prefix . "_parent"]); } } } // end while } //TODO: temporary output: debug::rr(array_keys($records)); debug::rr($records); return $stdout; }