本文整理汇总了PHP中sql_getRows函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_getRows函数的具体用法?PHP sql_getRows怎么用?PHP sql_getRows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sql_getRows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateEmail
function CreateEmail($mailto = '', $subject = '', $text = '')
{
$this->AddStrings($row);
if ($mailto == 'use_client_selection' && $_SESSION['use_client_selection']) {
$client_selection = join(' AND ', $_SESSION['use_client_selection']);
$row['use_client_selection'] = '1';
$emails = $this->GetValue("SELECT COUNT(*) FROM clients AS c WHERE subscribe=1 AND " . $client_selection);
$row['mailto'] = sprintf($this->str('client_selection'), $emails);
$row['mailto_readonly'] = 'READONLY';
} else {
$row['mailto'] = htmlspecialchars($mailto);
$row['use_client_selection'] = '0';
$row['client_selector']['value'] = ' ';
}
$row['subject'] = htmlspecialchars($subject);
$managers = sql_getRows("SELECT id, CONCAT(fullname,' <',email,'>') FROM admins WHERE email<>'' " . (is_root() ? '' : "AND id IN (" . join(',', $this->user['subst']) . ") AND fullname!=''") . " ORDER BY fullname", true);
$row['managers'] = $this->GetArrayOptions($managers, $this->user['id'], true);
###
include "editor/fckeditor.php";
$oFCKeditor = new FCKeditor();
$oFCKeditor->ToolbarSet = 'Common';
$oFCKeditor->Value = $text;
$row['editor'] = $oFCKeditor->ReturnFCKeditor('editor[html]', '100%', '100%');
###
return Parse($row, $this->name . '.tmpl');
}
示例2: Show
function Show()
{
global $limit;
$this->Init();
$this->AddStrings($ret);
$offset = (int) get('offset');
$limit = (int) get('limit', $this->Param('limit', $limit));
$count = sql_getValue("SELECT COUNT(*) FROM " . STAT_SESSIONS_TABLE . " WHERE robot=0 AND time_last>" . (time() - STAT_SESS_TIME * 60));
$data = sql_getRows("SELECT ip, 'count_pages', path, time, time_last FROM " . STAT_SESSIONS_TABLE . " WHERE robot=0 AND time_last>" . (time() - STAT_SESS_TIME * 60) . " ORDER BY time_last DESC LIMIT " . $offset . ", " . $limit);
// Построить массив для всех страниц ($this->path)
if ($data) {
$pages_id = array();
foreach ($data as $row) {
$pages_id = array_merge($pages_id, explode(' ', trim($row['path'])));
}
$pages_id = array_unique($pages_id);
$this->path_pages = sql_getRows("SELECT id, CONCAT(host, uri) AS page FROM " . STAT_PAGES_TABLE . " WHERE id IN (" . join(', ', $pages_id) . ")", true);
$this->path_keys = array_flip(array_keys($this->path_pages));
foreach ($this->path_pages as $page_id => $href) {
$ret['pathes']['row'][] = array('key' => $this->path_keys[$page_id] + 1, 'href' => $href);
}
}
// Main Table
$columns = array(array('header' => 'ip', 'nowrap' => '1', 'type' => 'ip'), array('header' => 'pages', 'align' => 'right', 'type' => 'pages'), array('header' => 'pathes', 'type' => 'path'), array('header' => 'time', 'align' => 'right', 'type' => 'time'), array('header' => 'last', 'align' => 'right', 'type' => 'last'));
if (isset($GLOBALS['_stat']['stat/stat_banlist'])) {
$columns[] = array('header' => 'ban', 'type' => 'ban', 'align' => 'center');
}
$ret['table'] = $this->stat_table(array('columns' => $columns, 'data' => $data, 'count' => $count, 'offset' => $offset, 'limit' => $limit));
$ret['navig'] = $this->NavigForm(array('hidden' => array('show' => $this->show)));
return Parse($ret, 'stat/stat.no_navig.tmpl');
}
示例3: Show
function Show()
{
if (!empty($GLOBALS['_POST'])) {
$actions = get('actions', '', 'p');
if ($actions) {
return $this->{$actions}();
}
}
require_once core('ajax_table');
$ret['id'] = 0;
$ret['auth_group'] = (int) get('auth_group');
$ret['auth_groups'] = sql_getRows('select id, name from auth_groups order by priority, name', true);
if (!$ret['auth_group']) {
$ret['auth_group'] = key($ret['auth_groups']);
}
$ret['auth_group_type'] = sql_getValue('
SELECT dt.type
FROM auth_groups AS ag
LEFT JOIN discount_types AS dt ON dt.id = ag.discount_type
WHERE ag.id = ' . $ret['auth_group']);
if ($ret['auth_group_type'] == 'fix') {
$ret['table'] = ajax_table(array('columns' => array(array('select' => 'dg.id', 'type' => 'checkbox'), array('select' => 'dg.name', 'display' => 'product_group'), array('select' => 'discounts.discount', 'display' => 'discount', 'type' => 'edit', 'align' => 'right', 'text-align' => 'right', 'maxlength' => 2, 'size' => 2), array('select' => '""', 'display' => '', 'width' => '50%')), 'from' => 'discount_groups AS dg
LEFT OUTER JOIN discounts ON discounts.discount_group_id = dg.id AND discounts.user_discount_group_id=' . $ret['auth_group'], 'orderby' => 'priority, name', 'params' => array('page' => $this->name, 'do' => 'show', 'id' => '', 'auth_group' => $ret['auth_group']), 'click' => 'ID=cb.value;'), $this);
} else {
$ret['table'] = ajax_table(array('columns' => array(array('select' => 'id', 'type' => 'checkbox', 'display' => 'id'), array('select' => 'volume', 'display' => 'upvolume', 'type' => 'edit', 'align' => 'right', 'text-align' => 'right', 'maxlength' => 10, 'size' => 10), array('select' => 'discount', 'display' => 'discount', 'type' => 'edit', 'align' => 'right', 'text-align' => 'right', 'maxlength' => 2, 'size' => 2), array('select' => '""', 'display' => '', 'width' => '50%')), 'from' => 'discounts_volume', 'where' => 'auth_group_id=' . $ret['auth_group'], 'orderby' => 'volume', 'params' => array('page' => $this->name, 'do' => 'show', 'id' => '', 'auth_group' => $ret['auth_group']), 'click' => 'ID=cb.value;'), $this);
}
$this->AddStrings($ret);
return $this->Parse($ret, $this->name . '.tmpl');
}
示例4: Show
function Show()
{
if (!empty($GLOBALS['_POST'])) {
$actions = get('actions', '', 'p');
if ($actions) {
return $this->{$actions}();
}
}
$this->SetValues();
require_once core('ajax_table');
$data['thisname'] = $this->name;
$data['root'] = is_root();
$this->AddStrings($data);
$_tables = sql_getRows('SHOW tables');
foreach ($_tables as $key => $val) {
$tables[$val] = $val;
}
$_transactions = sql_getColumn('SELECT distinct action FROM ' . $this->table . ' ORDER BY action');
foreach ($_transactions as $key => $val) {
$transactions[$val] = $val;
}
$where = '';
if ($this->from_date && $this->to_date) {
$where = ' UNIX_TIMESTAMP(date)>=' . $this->from_date . ' AND UNIX_TIMESTAMP(date)<=' . $this->to_date;
}
$data['table'] = ajax_table(array('columns' => array(array('select' => 'user', 'display' => 'user', 'width' => '1px', 'flags' => FLAG_SORT | FLAG_SEARCH), array('select' => 'object', 'display' => 'object', 'width' => '1px', 'flags' => FLAG_SORT | FLAG_FILTER | FLAG_SEARCH, 'filter_type' => 'array', 'filter_value' => array('' => '-- все --') + $tables, 'filter_rule' => 'find_in_set'), array('select' => 'action', 'display' => 'action', 'width' => '1px', 'flags' => FLAG_SORT | FLAG_FILTER | FLAG_SEARCH, 'filter_type' => 'array', 'filter_value' => array('' => '-- все --') + $transactions), array('select' => 'description', 'display' => 'description', 'type' => 'description', 'flags' => FLAG_SEARCH), array('select' => 'date', 'display' => 'date', 'type' => 'datetime', 'width' => '100px', 'flags' => FLAG_SORT)), 'from' => $this->table, 'where' => $where, 'orderby' => 'date DESC', 'params' => array('page' => $this->name, 'do' => 'show'), 'dblclick' => '', 'click' => ''), $this);
$data['navig'] = $this->NavigForm();
return $this->parse($data, $this->name . '.tmpl');
}
示例5: ElemInit
function ElemInit()
{
$id_user = (int) get('id', 0, 'pg');
global $site_domains;
$user_roles = array();
$user_roles_tmp = sql_getRows("SELECT * FROM auth_users_roles WHERE user_id = " . (int) $id_user);
$roles = sql_getRows("SELECT * FROM acl_roles");
foreach ($user_roles_tmp as $v) {
$user_roles[$v['root_id']][$v['role_id']] = true;
}
unset($user_roles_tmp);
// рисуем таблицу
$data = '<table class="ajax_table_main" cellspacing="1">';
$data .= '<tr class="ajax_table_header_row">';
$data .= '<th class="ajax_table_header_cell"> </th>';
foreach ($roles as $role) {
$data .= '<th class="ajax_table_header_cell" style="text-align: center;">' . $role['description'] . '</th>';
}
$data .= '</tr>';
foreach ($site_domains as $site) {
foreach ($site['langs'] as $l) {
$data .= '<tr class="ajax_table_row">';
$data .= '<td class="ajax_table_cell" style="text-align: left; vertical-align: middle">' . $site['descr'] . (count($site['langs']) > 1 ? ' (' . $l['descr'] . ')' : '') . '<br /><a target="_blank" href="http://' . $site['name'] . '/' . (count($site['langs']) > 1 ? $l['name'] : '') . '">' . $site['name'] . '</a></td>';
reset($roles);
foreach ($roles as $role) {
$role_checked = isset($user_roles[$l['root_id']][$role['id']]) ? "checked" : null;
$data .= '<td class="ajax_table_cell" style="text-align: center;"><input type="checkbox" name="fld[sites][' . $l['root_id'] . '][roles][' . $role['id'] . ']" value="1" ' . $role_checked . ' /></td>';
}
$data .= '</tr>';
}
}
$data .= '</table>';
$this->elem_fields['columns']['data']['value'] = $data;
return parent::ElemInit();
}
示例6: ElemInit
function ElemInit()
{
$columns = sql_getRows("SHOW COLUMNS FROM " . $this->elem_table . "", true);
if (!isset($columns['footer_text_radio'])) {
sql_query("ALTER TABLE " . $this->elem_table . " ADD footer_text_radio TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0 - редактор текста; 1 - html-код баннера'");
}
if (!isset($columns['footer_title'])) {
sql_query("ALTER TABLE {$this->elem_table} ADD footer_title VARCHAR( 255 ) NOT NULL COMMENT 'Название кнопки Подробнее';");
}
if (!isset($columns['footer_title_link'])) {
sql_query("ALTER TABLE {$this->elem_table} ADD footer_title_link VARCHAR( 255 ) NOT NULL COMMENT 'Ссылка на кнопке Подробнее';");
}
$id = (int) get('id');
if ($id) {
$infoblock_end = sql_getRow("SELECT * FROM " . $this->elem_table . " WHERE id = " . $id);
if ($infoblock_end['footer_text_radio']) {
$this->elem_fields['columns']['footer_text']['value'] = htmlspecialchars($infoblock_end['footer_text']);
$this->elem_fields['columns']['footer_text_area']['value'] = $infoblock_end['footer_text'];
} else {
$this->elem_fields['columns']['footer_text_fck']['value'] = $infoblock_end['footer_text'];
}
}
$this->script .= "\n\n function elem1(name) {\n return \$('#tr_fld\\\\[" . $this->tabname . "\\\\]\\\\[' + name + '\\\\]');\n }\n\n function elemName1(name) {\n return 'fld[" . $this->tabname . "][' + name + ']';\n };\n\n function getFck1(name) {\n name = elemName1(name);\n for(nameFck in CKEDITOR.instances) {\n if(name == nameFck) {\n return CKEDITOR.instances[name];\n }\n }\n }\n\n function open_fck_footer(name_fck, name_area) {\n var fck = getFck1(name_fck);\n var footer_text_fck = \$(elem1(name_fck));\n var footer_text_area = \$(elem1(name_area));\n\n footer_text_fck.children('span').show();\n footer_text_area.hide();\n\n var data = footer_text_area.children('textarea').val();\n if (data.length) fck.setData(data);\n\n fck.container.show();\n fck.updateElement();\n }\n\n function close_fck_footer(name_fck, name_area) {\n var fck = getFck1(name_fck);\n var footer_text_fck = \$(elem1(name_fck));\n var footer_text_area = \$(elem1(name_area));\n fck.container.hide();\n fck.updateElement();\n\n footer_text_fck.children('span').hide();\n footer_text_area.show();\n footer_text_area.children('textarea').css({\n 'width' : '98%',\n 'height' : fck.config.height\n });\n\n var data = fck.getData();\n if (data.length) footer_text_area.children('textarea').val(data);\n }\n\n \$(function () {\n var footer_text_radio = \$(elem1('footer_text_radio')).children('input');\n \$(footer_text_radio).click(function() {\n if(\$(this).val() == 1) {\n close_fck_footer('footer_text_fck', 'footer_text_area');\n } else {\n open_fck_footer('footer_text_fck', 'footer_text_area');\n }\n });\n\n CKEDITOR.on( 'instanceReady', function( ev )\n {\n " . (isset($infoblock_end) && $infoblock_end['footer_text_radio'] ? "close_fck_footer" : "open_fck_footer") . "('footer_text_fck', 'footer_text_area');\n });\n });\n ";
TElems::ElemInit();
}
示例7: GetTable
function GetTable()
{
global $limit;
$offset = (int) get('offset');
$limit = (int) get('limit', $this->Param('limit', $limit));
$search = get('find', '');
$search_state = '';
if (!empty($search)) {
$search_state = ' AND (city.name LIKE "' . $search . '" OR region.name LIKE "' . $search . '")';
}
$q = "SELECT city.name AS city, COUNT(*) AS kol, COUNT(*) as proc, region.name as region\n\t\tFROM " . $this->sess_table . " AS sess\n\t\tLEFT JOIN " . STAT_CITIES_TABLE . " AS city ON sess.city = city.id\n\t\tLEFT JOIN " . STAT_REGIONS_TABLE . " AS region ON city.reg = region.id\n\t\tWHERE sess.robot=0 {$search_state}\n\t\tGROUP BY sess.city\n\t\tORDER BY kol DESC\n\t\t";
$data = sql_getRows($q);
$all_total = sql_getValue("SELECT COUNT(*) FROM " . $this->sess_table . " AS sess\n LEFT JOIN " . STAT_CITIES_TABLE . " AS city ON sess.city = city.id\n LEFT JOIN " . STAT_REGIONS_TABLE . " AS region ON city.reg = region.id\n WHERE sess.robot=0");
# исправляем пустое имя
foreach ($data as $k => $v) {
if ($v['city'] == '') {
$data[$k]['city'] = $this->str('unknown_city');
} else {
$data[$k]['city'] = $v['city'] . ' (' . $v['region'] . ')';
}
}
# считаем проценты и записываем для каждого значения
foreach ($data as $k => $v) {
$data[$k]['proc'] = 100 * $v['kol'] / $all_total;
unset($data[$k]['region']);
}
$total_head = array('', $this->str('visitors'));
$total[] = array($this->str('total_period'), $all_total);
// Main Table
$ret['table'] = $this->stat_table(array('columns' => array(array('header' => 'city', 'nowrap' => 1, 'type' => 'city'), array('header' => 'visitors', 'align' => 'right', 'width' => '20%'), array('header' => 'percent', 'align' => 'right', 'width' => '50%', 'type' => 'graph')), 'data' => $data, 'total' => $total, 'total_head' => $total_head, 'count' => count($data), 'offset' => $offset, 'limit' => $limit));
return $ret;
}
示例8: ElemInit
function ElemInit()
{
$columns = sql_getRows("SHOW COLUMNS FROM `publications`", true);
if (!isset($columns['allow_comments'])) {
unset($this->elem_fields['columns']['allow_comments']);
}
return parent::ElemInit();
}
示例9: GetCSVData
function GetCSVData()
{
$filename = $_SERVER['DOCUMENT_ROOT'] . BASE . '.backup/' . $this->name . '_' . date('Y-m-d') . '.csv';
// заголовки
echo $this->_str('ips') . ';' . $this->_str('viewed') . "\n";
$rows = sql_getRows("\n\t\t\tSELECT IF(ip<0, INET_NTOA(ip+4294967296), INET_NTOA(ip)) as name, COUNT(*) as kol\n\t\t\tFROM " . $this->sess_table . "\n\t\t\tWHERE robot=0 GROUP BY ip ORDER BY kol DESC");
foreach ($rows as $k => $v) {
echo (isset($v['name']) ? $v['name'] : 0) . ';' . (isset($v['kol']) ? $v['kol'] : 0) . "\n";
}
}
示例10: dynamic_img
function dynamic_img()
{
$images = sql_getRows("SELECT * FROM `" . $this->table . "`\n WHERE\n image != '' AND\n visible = '1' AND\n FIND_IN_SET('" . ROOT_ID . "', root_ids)\n ORDER BY priority, name", true);
foreach ($images as $key => $value) {
if (!is_file(substr($value['image'], 1))) {
unset($images[$key]);
}
}
return array('slider' => $images);
}
示例11: GetCSVData
function GetCSVData()
{
// заголовки
$data = $this->_str('date') . ';' . $this->_str('time') . ';' . $this->_str('ip') . ';' . $this->_str('host1') . ';' . $this->_str('address1') . ';' . $this->_str('host2') . ';' . $this->_str('address2') . ';' . $this->_str('agent') . ';' . $this->_str('country') . ';' . $this->_str('search') . ';' . $this->_str('client') . "\n";
$sql = "SELECT temp.time, IF(s.ip<0, INET_NTOA(s.ip+4294967296), INET_NTOA(s.ip)) as ip, p1.uri as address1, p2.uri as address2, p2.search_ph as search, p1.host as host1, p2.host as host2, a.name as agent, c.name_" . lang() . " as country, CONCAT(auth.login,' <',auth.lname,' ',auth.name,' ',auth.tname,'> ') as client FROM " . $this->log_table . " AS temp\n LEFT JOIN stat_sessions AS s ON s.sess_id=temp.sess_id\n LEFT JOIN stat_pages AS p1 ON p1.id=temp.page_id\n LEFT JOIN stat_pages AS p2 ON p2.id=temp.ref_id\n LEFT JOIN stat_agents AS a ON a.id=s.agent_id\n LEFT JOIN auth_users AS auth ON auth.id=s.client_id\n LEFT JOIN " . STAT_COUNTRIES_TABLE . " AS c ON c.country_id=s.country";
$rows = sql_getRows($sql);
foreach ($rows as $k => $v) {
$data .= (isset($v['time']) ? date("d-m-Y", $v['time']) : 0) . ';' . (isset($v['time']) ? date("H:i:s", $v['time']) : 0) . ';' . (isset($v['ip']) ? $v['ip'] : 0) . ';' . (isset($v['host1']) ? $v['host1'] : '') . ';' . (isset($v['address1']) ? $v['address1'] : '') . ';' . (isset($v['host2']) ? $v['host2'] : '') . ';' . (isset($v['address2']) ? $v['address2'] : '') . ';' . (isset($v['agent']) ? $v['agent'] : '') . ';' . (isset($v['country']) ? $v['country'] : '') . ';' . (isset($v['search']) ? $v['search'] : '') . ';' . (isset($v['client']) ? $v['client'] : '') . "\n";
}
return $data;
}
示例12: ShowRecycle
function ShowRecycle()
{
global $limit;
$limit = -1;
require_once core('ajax_table');
$columns = sql_getRows('SHOW columns FROM ' . $this->table, 'Field');
$name = isset($columns['name']) ? 'name' : 'address';
$this->AddStrings($row);
$row['table'] = ajax_table(array('columns' => array(array('select' => 'id', 'display' => 'id', 'type' => 'checkbox'), array('select' => $name, 'display' => 'name')), 'where' => 'visible<0 and obj_type_id="room"', 'orderby' => 'address', 'params' => array('page' => $this->name, 'do' => 'Show')), $this);
return Parse($row, 'recycle.tmpl');
}
示例13: ElemInit
function ElemInit()
{
$columns = sql_getRows("SHOW COLUMNS FROM `tree`", true);
if (!isset($columns['redirect'])) {
sql_query("ALTER TABLE tree ADD redirect VARCHAR( 255 ) NOT NULL;");
}
if (!isset($columns['is_link'])) {
sql_query("ALTER TABLE tree ADD is_link TINYINT( 1 ) NOT NULL DEFAULT '0';");
}
parent::ElemInit();
}
示例14: table_get_product
function table_get_product(&$value, &$column, &$row)
{
$sql = "SELECT id, name FROM products WHERE product_type_id=" . $row['id'];
$products = array('0' => 'не указан') + sql_getRows($sql, true);
$html = "\n\t\t\t <input type='hidden' name='fld[" . $row['id'] . "][composition_id]' value='" . $row['composition_id'] . "'>\n\t\t\t <input type='hidden' name='fld[" . $row['id'] . "][id]' value='" . $row['id'] . "'>\n\t\t";
$html .= "<select name='fld[" . $row['id'] . "][elem_id]'>";
foreach ($products as $k => $v) {
$html .= "<option value='" . $k . "' " . ($k == $value ? "selected" : "") . ">" . $v . "</option>\t";
}
$html .= "</select>";
return $html;
}
示例15: GetCSVData
function GetCSVData()
{
$filename = $_SERVER['DOCUMENT_ROOT'] . BASE . '.backup/' . $this->name . '_' . date('Y-m-d') . '.csv';
// заголовки
echo $this->_str('client_name') . ';' . $this->_str('sessions') . "\n";
$this->sess_table = 'stat_sessions';
sql_query("\n\t\t\tCREATE TEMPORARY TABLE tmp_stat_clients\n\t\t\tSELECT sess.client_id AS client_id, cl.name AS name , cl.lname AS surname\n\t\t\tFROM " . $this->sess_table . " AS sess LEFT JOIN " . $this->clients_table . " AS cl ON cl.id=sess.client_id\n\t\t\tWHERE sess.client_id!=0 AND sess.robot=0");
$rows = sql_getRows("SELECT IF(name<>'',name,'n/a') AS name, COUNT(*) AS kol FROM tmp_stat_clients GROUP BY client_id ORDER BY kol DESC");
foreach ($rows as $k => $v) {
echo (isset($v['name']) ? $v['name'] : 0) . ';' . (isset($v['kol']) ? $v['kol'] : 0) . "\n";
}
}