本文整理汇总了PHP中table类的典型用法代码示例。如果您正苦于以下问题:PHP table类的具体用法?PHP table怎么用?PHP table使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了table类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_comments_remove
function action_comments_remove()
{
$comm = new table("comments");
$id = intval($_GET["id"]);
$comm->delete($id);
show_msg("删除成功", $_SERVER["HTTP_REFERER"]);
}
示例2: table_nodes
function table_nodes()
{
global $construct, $db, $main;
$form_search_nodes = $this->form_search_nodes();
$where = $form_search_nodes->db_data_where(array("nodes__name" => "starts_with"));
if ($main->userdata->privileges['admin'] !== TRUE) {
$where = "users.status = 'activated'" . ($where != '' ? ' AND (' . $where . ')' : "");
}
$table_nodes = new table(array('TABLE_NAME' => 'table_nodes'));
$table_nodes->db_data('nodes.id, nodes.name AS nodes__name, areas.name AS areas__name', 'nodes
LEFT JOIN areas ON nodes.area_id = areas.id
LEFT JOIN regions ON areas.region_id = regions.id ' . 'INNER JOIN users_nodes ON nodes.id = users_nodes.node_id ' . 'LEFT JOIN users ON users.id = users_nodes.user_id', $where != '' ? $where : "", "nodes.id", "nodes.id ASC");
$table_nodes->db_data_search($form_search_nodes);
for ($i = 1; $i < count($table_nodes->data); $i++) {
if (isset($table_nodes->data[$i])) {
$table_nodes->data[$i]['nodes__name'] .= " (#" . $table_nodes->data[$i]['id'] . ")";
$table_nodes->info['PICKUP_VALUE'][$i] = $table_nodes->data[$i]['id'];
$table_nodes->info['PICKUP_OUTPUT'][$i] = $table_nodes->data[$i]['nodes__name'];
}
}
$table_nodes->info['PICKUP_COLUMN'] = 'nodes__name';
$table_nodes->info['PICKUP_OBJECT'] = stripslashes(get('object'));
$table_nodes->db_data_remove('id');
return $table_nodes;
}
示例3: __construct
function __construct()
{
parent::__construct();
$geometryColumnsObj = new table("settings.geometry_columns_view");
$this->rows = $geometryColumnsObj->getRecords();
$this->rows = $this->rows['data'];
}
示例4: updateCartoMobileSettings
function updateCartoMobileSettings($data, $_key_)
{
$table = new table("settings.geometry_columns_join");
$data = $table->makeArray($data);
$cartomobileArr = (array) json_decode($this->getValueFromKey($_key_, "cartomobile"));
foreach ($data as $value) {
$safeColumn = $table->toAscii($value->column, array(), "_");
if ($value->id != $value->column && $value->column && $value->id) {
unset($cartomobileArr[$value->id]);
}
$cartomobileArr[$safeColumn] = $value;
}
$conf['cartomobile'] = json_encode($cartomobileArr);
$conf['_key_'] = $_key_;
$table->updateRecord(json_decode(json_encode($conf)), "_key_");
$this->execQuery($sql, "PDO", "transaction");
if (!$this->PDOerror || !$sql) {
$response['success'] = true;
$response['message'] = "Column renamed";
} else {
$response['success'] = false;
$response['message'] = $this->PDOerror[0];
}
return $response;
}
示例5: query
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);
}
示例6: get_table
function get_table()
{
$obj_test = new table();
@$obj_test->create_table();
@$obj_test->create_content();
//@table::create_table();
}
示例7: table_dns
function table_dns()
{
global $construct, $db, $vars;
$form_search_dns = $this->form_search_dns();
if (substr($form_search_dns->data[1]['value'], -strlen("." . $vars['dns']['root_zone'])) == "." . $vars['dns']['root_zone']) {
$form_search_dns->data[1]['value'] = substr($form_search_dns->data[1]['value'], 0, -strlen("." . $vars['dns']['root_zone']));
}
$where = $form_search_dns->db_data_where(array("dns_zones__name" => "starts_with"));
$table_dns = new table(array('TABLE_NAME' => 'table_dns', 'FORM_NAME' => 'table_dns'));
$table_dns->db_data('dns_zones.id AS dns_zones__id, dns_zones.name AS dns_zones__name, dns_zones.type, dns_zones.date_in, dns_zones.status, nodes.name AS nodes__name, nodes.id AS nodes__id', 'dns_zones
LEFT JOIN nodes ON dns_zones.node_id = nodes.id', $where, "", "dns_zones.status ASC, dns_zones.type ASC, dns_zones.name ASC");
for ($i = 1; $i < count($table_dns->data); $i++) {
if (isset($table_dns->data[$i])) {
$table_dns->data[$i]['nodes__name'] .= " (#" . $table_dns->data[$i]['nodes__id'] . ")";
if ($table_dns->data[$i]['type'] == 'forward') {
$table_dns->data[$i]['dns_zones__name'] .= "." . $vars['dns']['root_zone'];
}
$table_dns->info['EDIT'][$i] = makelink(array("page" => "nodes", "node" => $table_dns->data[$i]['nodes__id']));
}
}
$table_dns->info['EDIT_COLUMN'] = 'nodes__name';
$table_dns->db_data_remove('dns_zones__id', 'type', 'nodes__id');
$table_dns->db_data_translate('dns_zones__status');
return $table_dns;
}
示例8: stat_single_area
/**
统计单个地区出现的次数;
*/
static function stat_single_area($area)
{
global $DBR;
$pw = new table("pw_threads");
$row = $pw->findROW("count(*) as c", "fid=" . BBS_BID . " AND subject like '%" . mysql_escape_string($area) . "%'");
return intval($row["c"]);
}
示例9: parseTable
private function parseTable(DOMNode $tableNode)
{
$table = new table($tableNode->getAttribute('name'));
$allFieldsList = $tableNode->getElementsByTagName('field');
for ($i = 0; $i < $allFieldsList->length; $i++) {
$fieldNode = $allFieldsList->item($i);
$table->addField($this->parseField($fieldNode));
}
$utags = $tableNode->getElementsByTagName('unique');
$ftag = $utags->item(0);
$uniqueKeys = $ftag->nodeValue;
//only one unique key supported
$table->addUniqueKeys(explode(',', $uniqueKeys));
$utags = $tableNode->getElementsByTagName('primary');
$ftag = $utags->item(0);
$pKey = $ftag->nodeValue;
$table->setPrimaryAutocountKey($pKey);
$allRowsList = $tableNode->getElementsByTagName('row');
for ($i = 0; $i < $allRowsList->length; $i++) {
$rowNode = $allRowsList->item($i);
$table->addRow($this->parseRow($rowNode, $table->getFields(), $i));
}
$table->setNewID($tableNode->getAttribute('newID'));
return $table;
}
示例10: table_ip_ranges
function table_ip_ranges()
{
global $construct, $db;
$form_search_ranges = $this->form_search_ranges();
$where = $form_search_ranges->db_data_where(array('ip' => 'exclude'));
$table_ip_ranges = new table(array('TABLE_NAME' => 'table_ip_ranges', 'FORM_NAME' => 'table_ip_ranges'));
$s_ip = $form_search_ranges->data[0]['value'];
$where = $where != '' ? "(" . $where . ") AND " : "";
if ($s_ip != '') {
$where .= '(ip_ranges.ip_start >= ' . ip2long(correct_ip_min($s_ip, TRUE, 1)) . ' AND ip_ranges.ip_start <= ' . ip2long(correct_ip_max($s_ip, TRUE, 1)) . ") OR " . '(ip_ranges.ip_start >= ' . ip2long(correct_ip_min($s_ip, TRUE, 2)) . ' AND ip_ranges.ip_start <= ' . ip2long(correct_ip_max($s_ip, TRUE, 2)) . ") OR " . '(ip_ranges.ip_start >= ' . ip2long(correct_ip_min($s_ip, TRUE, 3)) . ' AND ip_ranges.ip_start <= ' . ip2long(correct_ip_max($s_ip, TRUE, 3)) . ") AND ";
}
//$where =
// ($s_ip !=''?"ip_ranges.ip_start <= ".ip2long($s_ip)." AND ip_ranges.ip_end >= ".ip2long($s_ip)." AND ":"");
if ($where != '') {
$where = substr($where, 0, -5);
}
#@#
$table_ip_ranges->db_data('"" AS ip_range, ip_ranges.ip_start, ip_ranges.ip_end, ip_ranges.date_in, ip_ranges.status, nodes.name AS nodes__name, nodes.id AS nodes__id, communities.name AS communities__name', 'ip_ranges
LEFT JOIN nodes ON ip_ranges.node_id = nodes.id
LEFT JOIN communities ON nodes.community_id = communities.id', $where != '' ? "(" . $where . ")" : "", "", "ip_ranges.status ASC, ip_ranges.ip_start ASC");
#@#
foreach ((array) $table_ip_ranges->data as $key => $value) {
if ($key != 0) {
$table_ip_ranges->data[$key]['ip_start'] = long2ip($table_ip_ranges->data[$key]['ip_start']);
$table_ip_ranges->data[$key]['ip_end'] = long2ip($table_ip_ranges->data[$key]['ip_end']);
$table_ip_ranges->data[$key]['ip_range'] = $table_ip_ranges->data[$key]['ip_start'] . " - " . $table_ip_ranges->data[$key]['ip_end'];
$table_ip_ranges->data[$key]['nodes__name'] .= " (#" . $table_ip_ranges->data[$key]['nodes__id'] . ")";
$table_ip_ranges->info['EDIT'][$key] = makelink(array("page" => "nodes", "node" => $table_ip_ranges->data[$key]['nodes__id']));
}
}
$table_ip_ranges->info['EDIT_COLUMN'] = 'nodes__name';
$table_ip_ranges->db_data_remove('ip_start', 'ip_end', 'nodes__id');
$table_ip_ranges->db_data_translate('ip_ranges__status');
return $table_ip_ranges;
}
示例11: table_ip_ranges
function table_ip_ranges()
{
global $construct, $db, $lang;
$form_search_ranges = $this->form_search_ranges();
$where = $form_search_ranges->db_data_where(array('ip' => 'exclude', 'nodes__name' => 'starts_with', "total_active_p2p" => 'exclude', "total_active_aps" => 'exclude'));
$table_ip_ranges = new table(array('TABLE_NAME' => 'table_ip_ranges', 'FORM_NAME' => 'table_ip_ranges'));
$where = $where != '' ? "(" . $where . ") AND " : "";
if ($form_search_ranges->data[0]['value'] != '') {
$where .= "(";
$s_ranges = ip_to_ranges($form_search_ranges->data[0]['value']);
foreach ($s_ranges as $s_range) {
$where .= "(ip_ranges.ip_start BETWEEN " . ip2long($s_range['min']) . " AND " . ip2long($s_range['max']) . ") OR ";
}
$where = substr($where, 0, -4) . ") AND ";
}
if ($where != '') {
$where = substr($where, 0, -5);
}
$having = $form_search_ranges->db_data_where(array('ip' => 'exclude', 'ip_ranges__status' => 'exclude', 'ip_ranges__delete_req' => 'exclude', 'nodes__id' => 'exclude', 'nodes__name' => 'exclude'));
$table_ip_ranges->db_data('ip_ranges.id,
"" AS ip_range,
ip_ranges.ip_start,
ip_ranges.ip_end,
ip_ranges.date_in,
ip_ranges.status,
ip_ranges.delete_req,
COUNT(DISTINCT p2p.id) AS total_active_p2p,
COUNT(DISTINCT aps.id) AS total_active_aps,
"" AS total_active_peers', 'ip_ranges ' . 'LEFT JOIN nodes ON ip_ranges.node_id = nodes.id
LEFT JOIN links ON ip_ranges.node_id = links.node_id AND links.status = "active"
LEFT JOIN links AS p2p ON links.type = "p2p"
AND links.peer_node_id = p2p.node_id
AND p2p.type = "p2p"
AND p2p.peer_node_id = links.node_id
AND p2p.status = "active"
LEFT JOIN links as aps ON links.type = "ap"
AND links.id = aps.id', $where, "ip_ranges.id" . ($having != '' ? ' HAVING (' . $having . ')' : ""), "ip_ranges.date_in DESC, ip_ranges.status ASC");
$table_ip_ranges->db_data_search($form_search_ranges);
foreach ((array) $table_ip_ranges->data as $key => $value) {
if ($key != 0) {
$table_ip_ranges->data[$key]['ip_start'] = long2ip($table_ip_ranges->data[$key]['ip_start']);
$table_ip_ranges->data[$key]['ip_end'] = long2ip($table_ip_ranges->data[$key]['ip_end']);
$table_ip_ranges->data[$key]['ip_range'] = $table_ip_ranges->data[$key]['ip_start'] . " - " . $table_ip_ranges->data[$key]['ip_end'];
}
}
$table_ip_ranges->db_data_multichoice('ip_ranges', 'id');
for ($i = 1; $i < count($table_ip_ranges->data); $i++) {
if (isset($table_ip_ranges->data[$i])) {
$table_ip_ranges->data[$i]['total_active_peers'] = ($table_ip_ranges->data[$i]['total_active_p2p'] > 0 ? $table_ip_ranges->data[$i]['total_active_p2p'] . " " . $lang['backbones_abbr'] : "") . ($table_ip_ranges->data[$i]['total_active_aps'] > 0 ? " + " . $table_ip_ranges->data[$i]['total_active_aps'] . " " . $lang['aps_abbr'] : "");
$table_ip_ranges->info['EDIT'][$i] = make_ref('/hostmaster/range', array("iprange" => $table_ip_ranges->data[$i]['id']));
}
}
$table_ip_ranges->info['EDIT_COLUMN'] = 'ip_range';
$table_ip_ranges->info['MULTICHOICE_LABEL'] = 'delete';
$table_ip_ranges->db_data_remove('id', 'ip_start', 'ip_end', 'total_active_p2p', 'total_active_aps');
$table_ip_ranges->db_data_translate('ip_ranges__status', 'ip_ranges__delete_req');
return $table_ip_ranges;
}
示例12: __construct
public function __construct(PDO $pdo, table $table, array $parameters = array(), array $data = array())
{
$this->pdo = $pdo;
$this->table = $table;
$this->fields = '';
$this->order = $table->getDefaultOrder();
$this->limit = array();
$this->data = $data;
$this->queryType = '';
$this->queryText = '';
$this->parameters = $parameters;
$this->validationRules = $table->getValidationRules();
}
示例13: table_nodes
function table_nodes()
{
global $construct, $db, $main, $lang;
$form_search_nodes = $this->form_search_nodes();
$where = $form_search_nodes->db_data_where(array("nodes__name" => "starts_with", "total_active_peers" => 'exclude', "total_active_clients" => 'exclude', "has_ap" => 'exclude'));
$having = $form_search_nodes->db_data_where(array("nodes__id" => "exclude", "nodes__name" => "exclude", "areas__id" => "exclude", "regions__id" => "exclude", "has_ap" => 'exclude'));
if ($form_search_nodes->data[6]['value'] != '') {
$having .= ($having != '' ? ' AND ' : '') . 'total_active_aps ' . ($form_search_nodes->data[6]['value'] == 'Y' ? '>' : '=') . ' 0';
}
$table_nodes = new table(array('TABLE_NAME' => 'table_nodes'));
$table_nodes->db_data('nodes.id,
nodes.name AS nodes__name,
areas.name AS areas__name,
communities.name AS communities__name,
COUNT(DISTINCT p2p.id) AS total_active_p2p,
COUNT(DISTINCT aps.id) AS total_active_aps,
COUNT(DISTINCT p2p.id)+COUNT(DISTINCT client.id) AS total_active_peers,
COUNT(DISTINCT cl.id) AS total_active_clients, nodes.freeifs AS nodes__freeifs', 'nodes
LEFT JOIN areas ON nodes.area_id = areas.id
LEFT JOIN regions ON areas.region_id = regions.id
LEFT JOIN communities ON nodes.community_id = communities.id
LEFT JOIN links ON nodes.id = links.node_id AND links.status = "active"
LEFT JOIN links AS client ON links.peer_ap_id = client.id
AND links.type = "client"
AND client.type = "ap"
AND client.status = "active"
LEFT JOIN links AS p2p ON p2p.peer_node_id = links.node_id
AND links.peer_node_id = p2p.node_id
AND links.type = "p2p"
AND p2p.type = "p2p"
AND p2p.status = "active"
LEFT JOIN links AS aps ON nodes.id = aps.node_id
AND aps.type = "ap"
AND aps.status = "active"
LEFT JOIN links AS cl ON cl.peer_ap_id = aps.id
AND cl.type = "client"
AND cl.status = "active"
INNER JOIN users_nodes ON nodes.id = users_nodes.node_id
LEFT JOIN users ON users.id = users_nodes.user_id', 'users.status = "activated"' . ($where != '' ? ' AND (' . $where . ')' : ""), 'nodes.id' . ($having != '' ? ' HAVING (' . $having . ')' : ""), "total_active_peers DESC, total_active_aps DESC, total_active_clients DESC, nodes.id");
$table_nodes->db_data_search($form_search_nodes);
for ($i = 1; $i < count($table_nodes->data); $i++) {
if (isset($table_nodes->data[$i])) {
$table_nodes->data[$i]['nodes__name'] .= " (#" . $table_nodes->data[$i]['id'] . ")";
$table_nodes->data[$i]['total_active_peers'] = $table_nodes->data[$i]['total_active_peers'] . ($table_nodes->data[$i]['total_active_aps'] > 0 ? " (+" . $table_nodes->data[$i]['total_active_aps'] . " " . $lang['aps'] . ")" : "");
$table_nodes->info['EDIT'][$i] = makelink(array("page" => "nodes", "node" => $table_nodes->data[$i]['id']));
}
}
$table_nodes->info['EDIT_COLUMN'] = 'nodes__name';
$table_nodes->db_data_remove('id', 'total_active_p2p', 'total_active_aps');
return $table_nodes;
}
示例14: generate
function generate()
{
$this->appendSuperHeader();
$code = "";
$tables = $this->getTablesArray();
$code .= $this->getCodeStarter();
for ($a = 0; $a < count($tables); $a++) {
$thisTable = new table($tables[$a], $this->getDb());
$fields = $thisTable->getFieldNameArray();
$code .= $this->getLineEnder();
$code .= "// " . $thisTable->getTableName() . " Table" . $this->getLineEnder();
$code .= "define(\"TABLE_" . strtoupper($tables[$a]) . "\",\"" . $thisTable->getTableName() . "\");" . $this->getLineEnder();
$code .= "// Primary Key for Table " . $thisTable->getTableName() . $this->getLineEnder();
$code .= "define(\"FIELD_" . strtoupper($tables[$a]) . "_PK\",\"" . $thisTable->getPrimaryKey() . "\");" . $this->getLineEnder();
$code .= "// Field Name Mapping for Table " . $thisTable->getTableName() . $this->getLineEnder();
for ($b = 0; $b < count($fields); $b++) {
$code .= "define(\"FIELD_" . strtoupper($tables[$a]) . "_" . strtoupper($fields[$b]) . "\",\"" . $fields[$b] . "\");" . $this->getLineEnder();
}
$code .= "// Display Labels of Field for Table " . $thisTable->getTableName() . $this->getLineEnder();
for ($c = 0; $c < count($fields); $c++) {
$code .= "define(\"LABEL_" . strtoupper($tables[$a]) . "_" . strtoupper($fields[$c]) . "\",\"" . ucfirst(strtolower($fields[$c])) . "\");" . $this->getLineEnder();
}
$code .= $this->getLineEnder();
}
$code .= $this->getCodeEnder();
$this->appendToCode($code);
$beautifulCode = codeBeautifier::beautify($this->getSourceCode());
return $beautifulCode;
}
示例15: table_communities
function table_communities()
{
global $construct, $db, $lang;
$form_search_communities = $this->form_search_communities();
$where = "";
#$form_search_communities->db_data_where();
$table_communities = new table(array('TABLE_NAME' => 'table_communities', 'FORM_NAME' => 'table_communities'));
$table_communities->db_data('communities.id, communities.name,communities.fullname, communities.windURL, communities.TOS, communities.dnstld, communities.ns1, communities.ns2, communities.admins', 'communities', $where, '', "communities.id ASC");
$table_communities->db_data_search($form_search_communities);
foreach ((array) $table_communities->data as $key => $value) {
if ($key != 0) {
if ($table_communities->data[$key]['ns1']) {
$table_communities->data[$key]['ns1'] = long2ip($table_communities->data[$key]['ns1']);
#if ($table_services->data[$key]['protocol'] && $table_communities->data[$key]['port']) {
# $table_services->data[$key]['ip'] .= ' ('.$lang['db']['nodes_services__protocol-'.$table_communities->data[$key]['protocol']].'/'.$table_communities->data[$key]['port'].')';
#}
}
if ($table_communities->data[$key]['ns2']) {
$table_communities->data[$key]['ns2'] = long2ip($table_communities->data[$key]['ns2']);
}
$cadmins = explode(",", $table_communities->data[$key]['admins']);
#print_r($cadmins);echo "admins<br>";
foreach ($cadmins as $key_name => $key_value) {
$i++;
#print_r($key_value);
$queryusers = $db->query("SELECT\n\t\t\t\t\t\t\t\t\tusers.username\n\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\tusers\n\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\tusers.id = '{$key_value}'\n\t\t\t\t\t\t\t\t\t");
$usernames = mysql_fetch_assoc($queryusers);
#echo $usernames['username'];
$cadmins[$key_name] = $usernames['username'];
#echo $cadmins[$key_name];
#print_r($usernames);
#$cadmins[$key_name]=$usernames[$i];#echo "users:$key_name:$key_value<br>"; print_r($usernames);
#$new=implode(",",$usernames);
#$basket = array_replace_recursive($base, $replacements);print_r($basket);
#$usernames_comma_separated = implode(",", $usernames);
#$basket = array_combine($cadmins, $usernames);print_r($basket);
}
#$basket = array_combine($cadmins, $usernames);print_r($basket);
$table_communities->data[$key]['admins'] = implode(", ", $cadmins);
# $cadmins->data[$k]['links__ip'] = $cadmins->data[$k]['links__ip'];#@#
#$table_communities->data[$key]['nodes__name'] .= " (#".$table_communities->data[$key]['nodes__id'].")";
#$table_communities->info['LINK']['nodes__name'][$key] = makelink(array("page" => "nodes", "node" => $table_communities->data[$key]['nodes__id']));
#$table_communities->info['LINK']['services__title'][$key] = $table_communities->data[$key]['url'];
}
}
#$table_communities->db_data_translate('communities__TOS');
$table_communities->db_data_remove('TOS');
return $table_communities;
}