本文整理汇总了PHP中sql_getValue函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_getValue函数的具体用法?PHP sql_getValue怎么用?PHP sql_getValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sql_getValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MyCommit
function MyCommit($row)
{
// Переносим изображение
if ($row['image'] && getimagesize('..' . $row['image']) && strpos($row['image'], 'plans') === false) {
$object_id = sql_getValue('SELECT pid FROM obj_elem_plans WHERE id=' . $row['pid']);
$dir = '../files/objects/' . $object_id;
if (!is_dir($dir)) {
mkdir($dir);
mkdir($dir, 0770);
}
$dir .= '/plans';
if (!is_dir($dir)) {
mkdir($dir);
mkdir($dir, 0770);
}
$new_name = $dir . '/' . basename($row['image']);
rename('..' . $row['image'], $new_name);
$row['image'] = substr($new_name, 2);
}
if ($_POST['id']) {
sql_update($this->elem_table, $row, 'id = ' . $_POST['id']);
} else {
sql_insert($this->elem_table, $row);
}
$err = sql_getError();
if (empty($err)) {
return 1;
}
return $err;
}
示例2: showType
function showType()
{
global $notify_subscribe;
$data['type'] = get('type', '', 'pg');
$res = mysql_query($notify_subscribe[$data['type']]);
for ($i = 0; $i < mysql_num_fields($res); $i++) {
$field = mysql_fetch_field($res);
$comment = sql_getValue("\n\t\t\t\t\tSELECT \n\t\t\t\t\tcomment\n\t\t\t\t\tFROM phpmyadmin.pma_column_info \n\t\t\t\t\tWHERE \n\t\t\t\t\ttable_name='" . $field->table . "'\n\t\t\t\t\tAND column_name='" . $field->name . "'\n\t\t\t\t\tAND db_name='" . MYSQL_DB . "' \n\t\t\t\t\t");
$data['fields'][$field->table . '.' . $field->name] = $comment;
}
$data['fld'] = sql_getRow('SELECT * FROM notify_subscribe_tpls WHERE id="' . $data['type'] . '"');
include_fckeditor();
$oFCKeditor =& Registry::get('FCKeditor');
$oFCKeditor->ToolbarSet = 'Small';
$oFCKeditor->Value = $data['fld']['header'];
$data['fld']['header'] = $oFCKeditor->ReturnFCKeditor('fld[header]', '100%', '100px');
$oFCKeditor =& Registry::get('FCKeditor');
$oFCKeditor->ToolbarSet = 'Source';
$oFCKeditor->Value = $data['fld']['template'];
$data['fld']['template'] = $oFCKeditor->ReturnFCKeditor('fld[template]', '100%', '200px');
$oFCKeditor =& Registry::get('FCKeditor');
$oFCKeditor->ToolbarSet = 'Small';
$oFCKeditor->Value = $data['fld']['footer'];
$data['fld']['footer'] = $oFCKeditor->ReturnFCKeditor('fld[footer]', '100%', '100px');
$this->AddStrings($data);
$tpl = NOTIFY_DIR . 'tmpls/' . $this->name . '.editform.tmpl';
if (is_file($tpl)) {
return Parse($data, $tpl);
}
return $content;
}
示例3: 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 (pag.uri LIKE "' . $search . '" OR pag.host LIKE "' . $search . '" OR pag.search_ph LIKE "' . $search . '")';
}
if (!empty($search)) {
// Всего строк в таблице
$count = sql_getValue("SELECT COUNT(DISTINCT(sess.ref_id)) FROM " . $this->sess_table . " AS sess\n LEFT JOIN " . STAT_PAGES_TABLE . " AS pag ON pag.id=sess.ref_id\n WHERE robot=0 AND ref_id!=0 {$search_state}");
} else {
// Всего строк в таблице
$count = sql_getValue("SELECT COUNT(DISTINCT(ref_id)) FROM " . $this->sess_table . " WHERE robot=0 AND ref_id!=0");
}
// Всего посетителей
$total_visitors = sql_getValue("SELECT COUNT(*) FROM " . $this->sess_table . " WHERE robot=0");
// всего по ссылке с других страниц
$total_links = sql_getValue("SELECT COUNT(*) FROM " . $this->sess_table . " WHERE robot=0 AND ref_id!=0");
// всего неопределено
$total_indefinite = $total_visitors - $total_links;
// всего по поисковой фразе
$total_search = sql_getValue("SELECT COUNT(*) FROM " . $this->sess_table . " AS sess LEFT JOIN " . STAT_PAGES_TABLE . " AS pag ON pag.id=sess.ref_id WHERE pag.search_ph!=''");
// данные для таблицы
$data = sql_getRows("\n\t\t\tSELECT pag.uri AS page, pag.search_ph AS search_ph, COUNT(*) AS kol, count(*)/" . $total_links . "*100 AS proc, pag.host AS host\n\t\t\tFROM " . $this->sess_table . " AS sess LEFT JOIN " . STAT_PAGES_TABLE . " AS pag ON pag.id=sess.ref_id\n\t\t\tWHERE sess.robot=0 AND sess.ref_id!='0' {$search_state} GROUP BY sess.ref_id ORDER BY kol DESC LIMIT " . $offset . ", " . $limit);
$total_head = array('', $this->_str('from_page'), $this->_str('percent'));
$total = array(array($this->str('total_visitors'), $total_visitors), array($this->str('total_links'), $total_links, $this->table_get_graph($total_links / $total_visitors * 100, array())), array($this->str('total_search'), $total_search, $this->table_get_graph($total_search / $total_visitors * 100, array())), array($this->str('total_indefinite'), $total_indefinite, $this->table_get_graph($total_indefinite / $total_visitors * 100, array())));
// Main Table
$ret['table'] = $this->stat_table(array('columns' => array(array('header' => 'page', 'nowrap' => 1, 'type' => 'page'), array('header' => 'search_ph', 'class' => 'tFirst', 'width' => '10%', 'type' => 'search_ph'), array('header' => 'from_page', 'align' => 'right', 'width' => '10%'), array('header' => 'percent', 'align' => 'right', 'width' => '50%', 'type' => 'graph')), 'data' => $data, 'total' => $total, 'total_head' => $total_head, 'count' => $count, 'offset' => $offset, 'limit' => $limit));
return $ret;
}
示例4: 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');
}
示例5: getDifTabs
function getDifTabs()
{
$id = get('id', 0, 'gp');
$elems =& $GLOBALS['cfg']['types'][100]['product']['elements'];
$sql = "SELECT solution_id FROM products WHERE id = " . $id;
$sol_type = sql_getValue($sql);
if (!isset($_GET['frame']) || $_GET['frame'] != 'cnt') {
session_start();
$_SESSION['elements'][$id] = $sol_type;
session_write_close();
} else {
session_start();
if (!$_SESSION['elements'][$id] && $sol_type || $_SESSION['elements'][$id] && !$sol_type) {
echo "\n \t\t<script>\n \t\t\tparent.location.reload();\n \t\t</script>\n \t";
}
session_write_close();
}
if ($sol_type && !in_array('elem_composition', $elems)) {
$elems[] = 'elem_composition';
foreach ($elems as $k => $v) {
if ($v == 'elem_params') {
unset($elems[$k]);
}
}
}
return $elems;
}
示例6: 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;
}
示例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 cl.login LIKE "' . $search . '"';
}
sql_query("\n\t\t\tCREATE TEMPORARY TABLE tmp_stat_clients\n\t\t\tSELECT sess.client_id AS client_id, cl.login AS login, 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" . $search_state);
$count = sql_getValue("SELECT COUNT(DISTINCT(client_id)) FROM tmp_stat_clients");
$total_value = sql_getValue("SELECT COUNT(*) FROM " . $this->sess_table . " AS sess LEFT JOIN " . $this->clients_table . " AS cl ON cl.id=sess.client_id WHERE sess.client_id!=0 AND sess.robot=0");
if ($count) {
$data = sql_getRows("SELECT IF(name<>'',CONCAT(login, ' (', surname, ' ', name, ')'),'n/a') AS name, COUNT(*) AS kol, COUNT(*)/" . $total_value . "*100 AS proc, client_id FROM tmp_stat_clients GROUP BY client_id ORDER BY kol DESC LIMIT " . $offset . ", " . $limit);
} else {
$data = array();
}
$total_head = array('', $this->_str('sessions'));
$total[] = array($this->str('total_period'), $total_value);
// Main Table
$columns = array(array('header' => 'client', 'nowrap' => 1, 'type' => 'name'), array('header' => 'sessions', 'align' => 'right', 'width' => '20%'), array('header' => 'percent', 'align' => 'right', 'width' => '50%', 'type' => 'graph'));
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, 'total' => $total, 'total_head' => $total_head, 'count' => $count, 'offset' => $offset, 'limit' => $limit));
return $ret;
}
示例8: getChilds
/**
* Функция строит многомерный массив районов
*
* @param int $id - id текущего района
* @param int $level - уровень вложенности
* @return массив
*/
function getChilds($id = null, $level = 0, $levels = SHOW_LEVELS)
{
$childs = array();
if (!isset($id)) {
$childs = sql_getRows("SELECT id, pid, name FROM " . $this->table . " WHERE pid IS NULL ORDER BY name", true);
} else {
$childs = sql_getRows("SELECT id, pid, name FROM " . $this->table . " WHERE pid=" . $id . " ORDER BY name", true);
}
if (!empty($childs) && $level < $levels - 1) {
foreach ($childs as $key => $val) {
for ($i = 1; $i <= $levels; $i++) {
$childs[$key]['d_pid'][$i] = isset($childs[$key]['d_pid'][$i - 1]) ? sql_getValue('SELECT pid FROM ' . $this->table . ' WHERE id=' . $childs[$key]['d_pid'][$i - 1]) : $childs[$key]['pid'];
if (!$childs[$key]['d_pid'][$i]) {
unset($childs[$key]['d_pid'][$i]);
break;
}
}
// Реверс массива пидов
$count = count($childs[$key]['d_pid']);
for ($j = 1; $j <= $count; $j++) {
$childs[$key]['d' . $j . '.pid'] = $childs[$key]['d_pid'][$count - $j + 1];
}
// Пустые значения
for ($j = 1; $j <= $levels; $j++) {
if (!isset($childs[$key]['d' . $j . '.pid'])) {
$childs[$key]['d' . $j . '.pid'] = '';
}
}
$childs[$key]['name'] = str_pad($val['name'], strlen($val['name']) + $level * strlen($this->prefix), $this->prefix, STR_PAD_LEFT);
$childs[$key]['items'] = $this->getChilds($val['id'], $level + 1, $levels);
}
}
return $childs;
}
示例9: get_solutions_type
function get_solutions_type()
{
$sol_id = sql_getValue("SELECT solution_id FROM products WHERE id=" . $_GET['id']);
if ($sol_id) {
$this->script .= "\n \t\t\t{literal}\n \t\t\t\tvar handler = window.onload;\n\t\t\t window.onload = function(){\n\t\t\t \thandler();\n\t\t\t \thideRow('tr_fld[product_type_id]');\n\t\t\t \thideRow('tr_fld[manufacturer_id]');\n\t\t\t \thideRow('tr_fld[price]');\n\t\t\t \thideRow('tr_fld[weight]');\n\t\t\t }\n \t\t\t{/literal}\n \t\t\t";
}
$rows = sql_GetRows("SELECT id, name FROM solutions_types ORDER BY priority, name", true);
return array('0' => 'не указан') + $rows;
}
示例10: TNotifyLog
function TNotifyLog()
{
global $actions, $str;
TTable::TTable();
$actions[$this->name] = array();
$actions[$this->name . '.editform'] = array('cancel' => array('title' => array('ru' => 'Закрыть', 'en' => 'Cancel'), 'onclick' => 'window.location=\'/admin/?page=' . $this->name . '\'', 'img' => 'icon.close.gif', 'display' => 'block', 'show_title' => true));
if (!empty($_GET['id'])) {
$temp = sql_getValue("SELECT `event` FROM `" . $this->table . "` WHERE `id`=" . $_GET['id']);
}
$str[get_class_name($this)] = array_merge($str[get_class_name($this)], array('title' => array('Логи уведомлений', 'Notifications log'), 'event' => array('Событие', 'Event'), 'date' => array('Дата', 'Date'), 'email' => array('Адрес', 'Email'), 'all_events' => array('Все события', 'All events')));
}
示例11: TGeo
function TGeo()
{
global $str, $actions;
TCustom_tree::TCustom_tree();
if ((int) $_GET['id']) {
$temp = sql_getValue("SELECT name FROM " . $this->table . " WHERE id=" . (int) $_GET['id']);
} else {
$temp = "Новый район";
}
$str[get_class_name($this)] = array_merge($str[get_class_name($this)], array('title' => array('География', 'Geo'), 'title_editform' => array("Район: " . $temp, 'Region: ' . $temp)));
}
示例12: ElemRedactBefore
/**
* Вызывается перед сохранением в базу
*
* @param array $fld
* @return array
*/
function ElemRedactBefore($fld)
{
$fld = parent::ElemRedactBefore($fld);
$error = "";
$page_id = get('id', 0, 'gp');
$page_pid = get('pid', 0, 'gp');
if ($page_pid) {
$parent = sql_getRow("SELECT dir, pids, level FROM " . $this->elem_table . " WHERE id=" . $page_pid);
} else {
$page_pid = sql_getValue("SELECT pid FROM `" . $this->elem_table . "` WHERE id=" . $page_id);
$parent = sql_getRow("SELECT dir, pids, level FROM " . $this->elem_table . " WHERE id=" . $page_pid);
}
if (!$page_id) {
// создание нового раздела
$auto = sql_getRow("SHOW TABLE STATUS LIKE '" . $this->elem_table . "'");
if ($auto['Auto_increment']) {
$new_id = $auto['Auto_increment'];
}
if ($page_pid == $page_id) {
$fld['level'] = 1;
} else {
$fld['level'] = $parent['level'] + 1;
}
$fld['priority'] = sql_getValue("SELECT MAX(priority) FROM `" . $this->elem_table . "` WHERE pid=" . $page_pid) + 1;
}
$page = $page_id ? $page_id : $new_id;
if ($page_pid != $page_id) {
# pids
$pids = explode('/', $parent['pids']);
if (!$pids[0]) {
array_shift($pids);
}
if (!$pids[count($pids) - 1]) {
array_pop($pids);
}
$pids[] = $page_pid;
$fld['pids'] = '/' . join('/', $pids) . '/';
# dir
$fld['dir'] = $parent['dir'] . $page . '/';
} else {
# pids
$fld['pids'] = '/' . $page_pid . '/';
$fld['dir'] = '/' . $page . '/';
}
# изменим next у родителя
sql_query("UPDATE tree SET next='1' WHERE id='" . (isset($parent['id']) ? $parent['id'] : $page_pid) . "'");
# Проверка на существование dir
$check = sql_getValue("SELECT id FROM " . $this->elem_table . " WHERE dir='" . $fld['dir'] . "'");
if ($check && $check != $page_id) {
$error_tab = $k;
$error = "Раздел с таким URL уже существует";
}
return array('fld' => $fld, '_error_text' => $error);
}
示例13: GetTable
function GetTable()
{
global $limit;
$offset = (int) get('offset');
$limit = (int) get('limit', $this->Param('limit', $limit));
$data = sql_getRows("SELECT id, ip FROM stat_banlist ORDER BY ip LIMIT " . $offset . ", " . $limit);
$count = sql_getValue("SELECT COUNT(DISTINCT(ip)) FROM stat_banlist");
// Main Table
$ret['table'] = $this->stat_table(array('columns' => array(array('header' => 'ip', 'type' => 'ip'), array('header' => 'unban', 'type' => 'unban', 'align' => 'center')), 'data' => $data, 'total' => $total, 'count' => $count, 'offset' => $offset, 'limit' => $limit));
return $ret;
}
示例14: TOrdersEd
function TOrdersEd()
{
global $str;
TTable::TTable();
####### Массив строковых констант ##########
if (!empty($_GET['id'])) {
$temp = sql_getValue('SELECT name FROM orders WHERE id=' . $_GET['id']);
} else {
$temp = '';
}
$str[get_class($this)] = array('saved' => array('Информация была успешно сохранена', 'Info has been successfully saved'), 'basic_caption' => array('Заявки', 'Order'), 'basic_tab' => array($temp, 'Order'), 'title' => array($temp, 'Order'));
}
示例15: ElemRedactB
function ElemRedactB($fld)
{
$fld = parent::ElemRedactB($fld);
// Пересчет цены в у.е
if ($fld['price']) {
$value = sql_getValue('SELECT value FROM currencies WHERE name="USD"');
if ($value) {
$fld['price_metr'] = $fld['price'] / $value;
}
}
return $fld;
}