本文整理汇总了PHP中table函数的典型用法代码示例。如果您正苦于以下问题:PHP table函数的具体用法?PHP table怎么用?PHP table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了table函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tpl_function_qishi_train_news_show
function tpl_function_qishi_train_news_show($params, &$smarty)
{
global $db;
$arr = explode(',', $params['set']);
foreach ($arr as $str) {
$a = explode(':', $str);
switch ($a[0]) {
case "新闻ID":
$aset['id'] = $a[1];
break;
case "列表名":
$aset['listname'] = $a[1];
break;
}
}
$aset = array_map("get_smarty_request", $aset);
$aset['id'] = $aset['id'] ? intval($aset['id']) : 0;
$aset['listname'] = $aset['listname'] ? $aset['listname'] : "list";
unset($arr, $str, $a, $params);
$sql = "select id,title,content,addtime,train_id from " . table('train_news') . " WHERE id=" . intval($aset['id']) . " LIMIT 1";
$val = $db->getone($sql);
if (empty($val)) {
header("HTTP/1.1 404 Not Found");
$smarty->display("404.htm");
exit;
}
$val['keywords'] = $val['title'];
$val['description'] = cut_str(strip_tags($val['content']), 60, 0, "");
$smarty->assign($aset['listname'], $val);
}
示例2: faq__load_answer
function faq__load_answer($faq_id = "")
{
$pars = array(':faq_id' => $faq_id);
$query = "SELECT * from " . table('lang') . "\n WHERE content_type='faq_answer'\n AND content_name= :faq_id";
$line = orsee_query($query, $pars);
return $line;
}
示例3: show
/**
*/
function show()
{
$filter_name = $_GET['object'] . '__' . $_GET['action'];
$default_filter = ['order_by' => 'date', 'order_direction' => 'desc'];
$sql = 'SELECT * FROM ' . db('log_auth');
return table($sql, ['filter' => (array) $_SESSION[$filter_name] + $default_filter, 'filter_params' => ['name' => 'like']])->user('user_id')->text('login')->link('group', './?object=user_groups&action=edit&id=%d', main()->get_data('user_groups'))->link('ip', './?object=' . $_GET['object'] . '&action=show_for_ip&id=%d')->date('date', ['format' => 'full', 'nowrap' => 1])->text('user_agent')->text('referer');
}
示例4: tpl_function_qishi_news_property
function tpl_function_qishi_news_property($params, &$smarty)
{
global $db;
$arr = explode(',', $params['set']);
foreach ($arr as $str) {
$a = explode(':', $str);
switch ($a[0]) {
case "列表名":
$aset['listname'] = $a[1];
break;
case "名称长度":
$aset['titlelen'] = $a[1];
break;
case "填补字符":
$aset['dot'] = $a[1];
break;
case "分类ID":
$aset['ID'] = $a[1];
break;
}
}
if (is_array($aset)) {
$aset = array_map("get_smarty_request", $aset);
}
$aset['listname'] = $aset['listname'] ? $aset['listname'] : "list";
$aset['titlelen'] = $aset['titlelen'] ? intval($aset['titlelen']) : 8;
if ($aset['ID']) {
$wheresql = " WHERE id=" . intval($aset['ID']);
}
$List = $db->getall("SELECT id,categoryname,category_order FROM " . table('article_property') . " " . $wheresql);
$smarty->assign($aset['listname'], $List);
}
示例5: tpl_function_qishi_simple_show
function tpl_function_qishi_simple_show($params, &$smarty)
{
global $db;
$arr = explode(',', $params['set']);
foreach ($arr as $str) {
$a = explode(':', $str);
switch ($a[0]) {
case "ID":
$aset['id'] = $a[1];
break;
case "ÁбíÃû":
$aset['listname'] = $a[1];
break;
}
}
$aset = array_map("get_smarty_request", $aset);
$aset['id'] = $aset['id'] ? intval($aset['id']) : 0;
$aset['listname'] = $aset['listname'] ? $aset['listname'] : "list";
unset($arr, $str, $a, $params);
$sql = "select * from " . table('simple') . " WHERE id='{$aset['id']}' AND audit=1 LIMIT 1";
$val = $db->getone($sql);
if (empty($val)) {
header("HTTP/1.1 404 Not Found");
$smarty->display("404.htm");
exit;
}
$val['keywords'] = "{$val['jobname']} {$val['comname']} ";
$val['description'] = cut_str(strip_tags($val['detailed']), 60, 0, "");
$smarty->assign($aset['listname'], $val);
}
示例6: generateConfirm
function generateConfirm($edit)
{
$dataInvalid = $this->isDataInvalid($edit);
if ($this->formbuilder) {
$this->formbuilder->bulk_set_answers($_POST[$this->event->formkey()]);
$dataInvalid .= $this->formbuilder->answers_invalid();
}
if ($dataInvalid) {
error_exit($dataInvalid . '<br>Please use your back button to return to the form, fix these errors, and try again.');
}
$output = para('Please confirm that this data is correct and click the submit button to proceed to the payment information page.');
$output .= form_hidden('edit[step]', 'submit');
$fields = array('Registration Status' => 'payment', 'Notes' => 'notes');
$rows = array();
foreach ($fields as $display => $column) {
array_push($rows, array($display, form_hidden("edit[{$column}]", $edit[$column]) . check_form($edit[$column])));
}
$output .= form_group('Registration details', "<div class='pairtable'>" . table(null, $rows) . '</div>');
if ($this->formbuilder) {
$form = $this->formbuilder->render_viewable();
$form .= $this->formbuilder->render_hidden();
$output .= form_group('Registration answers', $form);
}
$output .= para(form_submit('submit'));
return form($output);
}
示例7: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB:
table('authors')->where('name', '=', 'Ramish Fatima')->delete();
DB:
table('authors')->where('name', '=', 'Mahnoor Fatima')->delete();
}
示例8: region
function region()
{
$session_key = $_GET['object'] . '__' . $_GET['action'];
$filter = ['filter' => $_SESSION[$session_key], 'filter_params' => ['id' => 'in', 'value' => 'like']];
$table = table('SELECT * FROM ' . db('shop_regions'), $filter)->text('id', 'Номер')->text('value', 'Название')->btn_edit('', $this->_uri['edit'], ['no_ajax' => 1])->btn_delete('', $this->_uri['delete'])->btn_active('', $this->_uri['active'])->footer_add('', $this->_uri['add'], ['no_ajax' => 1]);
return $table;
}
示例9: index
public function index()
{
$id = intval($_REQUEST['id']);
$post_key = $this->_get('post_key', 'trim');
if (empty($id)) {
$where = array('post_key' => $post_key);
} else {
$where = array('id' => $id);
}
$where['post_time'] = array('elt', time());
$where['status'] = 1;
$res = $this->post_mod->relation(true)->where($where)->find();
if ($res) {
$res['cate_list'] = $this->post_cate_re_mod->relation(true)->where(array('post_id' => $res['id']))->select();
$this->assign('info', $res);
$tag_list = $this->post_tag_mod->relation(true)->where("post_id={$res['id']}")->select();
$this->assign('tag_list', $tag_list);
$this->assign('prev_post', $this->post_mod->where("id>{$res['id']} and status=1 and post_time<=" . time())->order("id asc")->find());
$this->assign('next_post', $this->post_mod->where("id<{$res['id']} and status=1 and post_time<=" . time())->order("id desc")->find());
$where = "id in(select post_id from " . table('post_tag') . " where \n tag_id in(select tag_id from " . table('post_tag') . " where post_id={$res['id']}) \n and post_id!={$res['id']})";
$this->assign('like_list', $this->post_mod->where($where)->limit(4)->select());
$post_tag = '';
foreach ($tag_list as $val) {
$post_tag .= $val['tag']['name'];
}
$this->_config_seo(C('pin_seo_config.post'), array('post_title' => $res['title'], 'post_tag' => $post_tag, 'user_name' => $res['uname'], 'seo_title' => $res['seo_title'], 'seo_keywords' => $res['seo_keys'], 'seo_description' => $res['seo_desc']));
$this->comment_list($res['id']);
} else {
$this->error("作品不存在");
}
$this->display();
}
示例10: score_entry_display
function score_entry_display()
{
global $dbh;
$sth = $dbh->prepare('SELECT * FROM score_entry WHERE team_id = ? AND game_id = ?');
$sth->execute(array($this->game->home_team, $this->game->game_id));
$home = $sth->fetch();
if (!$home) {
$home = array('score_for' => 'not entered', 'score_against' => 'not entered', 'defaulted' => 'no');
} else {
$entry_person = Person::load(array('user_id' => $home['entered_by']));
$home['entered_by'] = l($entry_person->fullname, "person/view/{$entry_person->user_id}");
}
$sth->execute(array($this->game->away_team, $this->game->game_id));
$away = $sth->fetch();
if (!$away) {
$away = array('score_for' => 'not entered', 'score_against' => 'not entered', 'defaulted' => 'no');
} else {
$entry_person = Person::load(array('user_id' => $away['entered_by']));
$away['entered_by'] = l($entry_person->fullname, "person/view/{$entry_person->user_id}");
}
$header = array(" ", $this->game->home_name . ' (home)', $this->game->away_name . ' (away)');
$rows = array();
$rows[] = array("Home Score:", $home['score_for'], $away['score_against']);
$rows[] = array("Away Score:", $home['score_against'], $away['score_for']);
$rows[] = array("Defaulted?", $home['defaulted'], $away['defaulted']);
$rows[] = array("Entered By:", $home['entered_by'], $away['entered_by']);
$rows[] = array("Entry time:", $home['entry_time'], $away['entry_time']);
return '<div class="listtable">' . table($header, $rows) . "</div>";
}
示例11: express
/**
*/
function express()
{
$date = date("Y-m-d");
$orders_info = db()->query_fetch_all("SELECT * FROM " . db('shop_orders') . " WHERE delivery_time LIKE '" . $date . "%' AND status = 1");
if (!empty($orders_info)) {
$orders = array_keys($orders_info);
$products = db()->query_fetch_all("SELECT o.*, p.name, p.price, p.cat_id\n\t\t\t\t\t\t\t\t\t\t\tFROM " . db('shop_order_items') . " as o\n\t\t\t\t\t\t\t\t\t\t\tRIGHT JOIN " . db('shop_products') . " as p ON o.product_id = p.id\n\t\t\t\t\t\t\t\t\t\t\tWHERE o.order_id IN(" . implode(",", $orders) . ") AND o.status = 1\n\t\t\t\t\t\t\t\t\t\t\tORDER BY o.order_id DESC");
}
$_category = _class("_shop_categories", "modules/shop/");
//always add one empty row in table for ajax
if (empty($products)) {
$products[] = ['product_id' => '-', 'name' => '-', 'quantity' => '-', 'price' => '-', 'order_id' => '-'];
$orders_info['-']['delivery_time'] = '-';
}
foreach ((array) $products as $k => $v) {
$replace[] = ["product_id" => $v['product_id'], "name" => $v['name'], "quantity" => $v['quantity'], "price" => module('shop')->_format_price(floatval($v['price'])), "order_id" => $v['order_id'], "id" => $v['order_id'] . '_' . $v['product_id'], "time" => str_replace($date, "", $orders_info[$v['order_id']]['delivery_time'])];
$table_tr[] = 'data-id="' . $v['order_id'] . '_' . $v['product_id'] . '" ';
}
if (!empty($_GET['ajax_mode'])) {
return json_encode($replace);
}
$table = table($replace)->text('order_id')->text('time')->text('name')->text('quantity')->text('product_id')->footer_link("PDF " . $date . " 10-12", './?object=' . $_GET['object'] . '&action=express_pdf&hours=10-12')->footer_link("PDF " . $date . " 13-15", './?object=' . $_GET['object'] . '&action=express_pdf&hours=13-15')->footer_link("PDF " . $date . " 17-20", './?object=' . $_GET['object'] . '&action=express_pdf&hours=17-20')->render(['table_attr' => 'id="express_catalog"', 'tr' => $table_tr]);
$replace = ['table' => $table];
return tpl()->parse("manage_shop/express", $replace);
}
示例12: textile
function textile($text, $lite = '')
{
if (get_magic_quotes_gpc() == 1) {
$text = stripslashes($text);
}
$text = incomingEntities($text);
$text = encodeEntities($text);
$text = fixEntities($text);
$text = cleanWhiteSpace($text);
$text = getRefs($text);
$text = noTextile($text);
$text = image($text);
$text = links($text);
$text = span($text);
$text = superscript($text);
$text = footnoteRef($text);
$text = code($text);
$text = glyphs($text);
$text = retrieve($text);
if ($lite == '') {
$text = lists($text);
$text = table($text);
$text = block($text);
}
/* clean up <notextile> */
$text = preg_replace('/<\\/?notextile>/', "", $text);
/* turn the temp char back to an ampersand entity */
$text = str_replace("x%x%", "&", $text);
$text = str_replace("<br />", "<br />\n", $text);
return trim($text);
}
示例13: batchInsert
function batchInsert($table, $data)
{
$sql = "INSERT INTO" . table($table) . "(";
$array = $data;
$keys = array_keys(array_shift($array));
//print_r($keys);
$fields = $values = array();
foreach ($keys as $v) {
$fields[] = '`' . $v . '`';
}
$sql .= implode(',', $fields);
$sql .= ") VALUES ";
foreach ($data as $k1 => $v1) {
$val = array();
foreach ($v1 as $v2) {
//print_r($v2);exit;
$val[] = $v2;
//print_r($val);exit;
}
$values[] = '(' . implode(',', $val) . ')';
}
$sql .= implode(',', $values);
$sql .= ";";
mysql_query($sql);
}
示例14: show
/**
*/
function show()
{
$filter_name = $_GET['object'] . '__' . $_GET['action'];
$default_filter = ['order_by' => 'date', 'order_direction' => 'desc'];
$sql = 'SELECT * FROM ' . db('log_redirects') . ' WHERE is_admin="' . strval(!$this->FOR_USER ? 1 : 0) . '"';
return table($sql, ['filter' => (array) $_SESSION[$filter_name] + $default_filter, 'filter_params' => ['url_from' => 'like', 'url_to' => 'like', 'ip' => 'like', 'user_agent' => 'like', 'referer' => 'like']])->admin('user_id')->link('ip', './?object=' . $_GET['object'] . '&action=show_for_ip&id=%d')->date('date', ['format' => 'full', 'nowrap' => 1])->text('user_agent')->text('referer')->text('url_from')->text('url_to')->text('exec_time');
}
示例15: insertUpdate
function insertUpdate($table, $rows, $primary)
{
$columns = array_keys(reset($rows));
$prefix = "INSERT INTO " . table($table) . " (" . implode(", ", $columns) . ") VALUES\n";
$values = array();
foreach ($columns as $key) {
$values[$key] = "{$key} = VALUES({$key})";
}
$suffix = "\nON DUPLICATE KEY UPDATE " . implode(", ", $values);
$values = array();
$length = 0;
foreach ($rows as $set) {
$value = "(" . implode(", ", $set) . ")";
if ($values && strlen($prefix) + $length + strlen($value) + strlen($suffix) > 1000000.0) {
// 1e6 - default max_allowed_packet
if (!queries($prefix . implode(",\n", $values) . $suffix)) {
return false;
}
$values = array();
$length = 0;
}
$values[] = $value;
$length += strlen($value) + 2;
// 2 - strlen(",\n")
}
return queries($prefix . implode(",\n", $values) . $suffix);
}