本文整理汇总了PHP中sql_rowset函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_rowset函数的具体用法?PHP sql_rowset怎么用?PHP sql_rowset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sql_rowset函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
$sql = 'SELECT forum_id, forum_name
FROM _forums
ORDER BY forum_order ASC';
$result = sql_rowset($sql);
foreach ($result as $i => $row) {
if (!$i) _style('forums');
_style('forums.row', array(
'FORUM_ID' => $row['forum_id'],
'FORUM_NAME' => $row['forum_name'])
);
}
return false;
}
$list = request_var('listContainer', array(0));
$orderid = 10;
foreach ($list as $catid) {
$sql = 'UPDATE _forums SET forum_order = ?
WHERE forum_id = ?';
sql_query(sql_filter($sql, $orderid, $catid));
$orderid += 10;
}
_pre('Update.', true);
}
示例2: _home
public function _home() {
global $config, $user, $cache;
$sql = 'SELECT e.event_topic, f.forum_name, t.topic_id, t.topic_title, t.topic_views, t.topic_replies
FROM _forum_topics t
LEFT JOIN _events e ON e.event_topic = t.topic_id
INNER JOIN _forums f ON t.forum_id = f.forum_id
WHERE t.forum_id NOT IN (38)
ORDER BY t.topic_time DESC
LIMIT 100';
$result = sql_rowset($sql);
foreach ($result as $i => $row) {
if (!$i) _style('topics');
_style('topics.row', array(
'TOPIC_ID' => s_link('topic', $row['topic_id']),
'TOPIC_FORUM' => $row['forum_name'],
'TOPIC_EVENT' => $row['event_topic'],
'TOPIC_TITLE' => $row['topic_title'],
'TOPIC_VIEWS' => $row['topic_views'],
'TOPIC_REPLIES' => $row['topic_replies'])
);
}
return;
}
示例3: _home
public function _home() {
global $config, $user, $cache;
$artist = request_var('a', '');
$redirect = request_var('r', '');
if (!empty($artist)) {
redirect(s_link('acp', array($redirect, 'a' => $artist)));
}
$artist_select = '';
if (!$user->is('founder')) {
$sql = 'SELECT ub
FROM _artists_auth
WHERE user_id = ?';
$artist_select = ' WHERE ub IN (' . _implode(',', sql_rowset(sql_filter($sql, $user->d('user_id')), false, 'ub')) . ') ';
}
$sql = 'SELECT ub, subdomain, name
FROM _artists
??
ORDER BY name';
$artists = sql_rowset(sql_filter($sql, $artist_select));
foreach ($artists as $i => $row) {
if (!$i) _style('artist_list');
_style('artist_list.row', array(
'URL' => s_link('acp', array($redirect, 'a' => $row['subdomain'])),
'NAME' => $row['name'])
);
}
return;
}
示例4: config
public function config() {
$sql = 'SELECT *
FROM _application';
$config = sql_rowset($sql, 'config_name', 'config_value');
return $config;
}
示例5: _home
public function _home() {
global $config, $user, $cache;
$this->_artist();
if ($this->remove()) {
return;
}
$sql = 'SELECT *
FROM _events e, _artists_events a
WHERE a.a_artist = ?
AND a.a_event = e.id
ORDER BY e.date DESC';
$result = sql_rowset(sql_filter($sql, $this->object['ub']));
foreach ($result as $i => $row) {
if (!$i) _style('events');
_style('events.row', array(
'ID' => $row['id'],
'TITLE' => $row['title'],
'DATE' => $user->format_date($row['date']))
);
}
return;
}
示例6: _home
public function _home() {
global $config, $user, $cache;
if (_button()) {
$forum_id = request_var('fid', 0);
$forum_alias = request_var('falias', '');
$sql = 'UPDATE _forums SET forum_alias = ?
WHERE forum_id = ?';
sql_query(sql_filter($sql, $forum_alias, $forum_id));
_pre($forum_id . ' > ' . $forum_alias, true);
}
$sql = 'SELECT forum_id, forum_name
FROM _forums
ORDER BY forum_order';
$result = sql_rowset($sql);
foreach ($result as $i => $row) {
if (!$i) _style('forums');
_style('forums.row', array(
'FORUM_ID' => $row['forum_id'],
'FORUM_NAME' => $row['forum_name'])
);
}
return;
}
示例7: _artist
public function _artist() {
global $user;
if ($user->is('artist')) {
$sql = 'SELECT a.ub
FROM _artists_auth t
INNER JOIN _artists a ON a.ub = t.ub
WHERE t.user_id = ?';
if ($artist_ary = sql_rowset(sql_filter($sql, $user->d('user_id')), false, 'ub')) {
$sql_where = sql_filter('WHERE ub IN (??)', implode(',', $artist_ary));
}
}
$artist = request_var('a', '');
$module = request_var('module', '');
$url = s_link('acp', array('artist_select', 'r' => $module));
if (empty($artist)) {
redirect($url);
}
if (!$this->object = get_artist($artist, true)) {
fatal_error();
}
v_style(array(
'ARTIST_SELECT' => $url,
'ARTIST_NAME' => $this->object['name'])
);
return;
}
示例8: home
public function home()
{
global $core, $bio;
$v = $this->__(array_merge(w('r'), _array_keys(w('v'), 0)));
if (!empty($v->v)) {
$sql = 'SELECT *
FROM _objects o, _objects_type t
WHERE o.object_id = ?
AND t.type_alias = ?
AND o.object_type = t.type_id';
$video = sql_rowset(sql_filter($sql, $v->v, 'tv'));
$sql = 'SELECT *
FROM _objects o, _objects_type t, _bio b
WHERE o.object_id <> ?
AND t.type_alias = ?
AND o.object_type = t.type_id
AND o.object_bio = b.bio_id
ORDER BY o.object_time';
$tv_list = sql_rowset(sql_filter($sql, $v->v, 'tv'));
$tv = w();
foreach ($video as $row) {
$tv[] = $row;
}
foreach ($tv_list as $row) {
$tv[] = $row;
}
//_pre($tv, true);
} else {
$sql = 'SELECT *
FROM _objects o, _objects_type t, _bio b
WHERE t.type_alias = ?
AND o.object_type = t.type_id
AND o.object_bio = b.bio_id
ORDER BY o.object_time';
$tv = sql_rowset(sql_filter($sql, 'tv'));
}
foreach ($tv as $i => $row) {
if (!$i) {
_style('tv', array('FIRST_SUBJECT' => $row->object_subject));
}
//$preg = preg_match("^http://(?<domain>([^./]+\\.)*youtube\\.com)(/v/|/watch\\?v=)(?<videoId>[A-Za-z0-9_-]{11})", $row->object_content);
preg_match('#(?<=(?:v|i)=)[a-zA-Z0-9-]+(?=&)|(?<=(?:v|i)\\/)[^&\\n]+|(?<=embed\\/)[^"&\\n]+|(?<=(?:v|i)=)[^&\\n]+|(?<=youtu.be\\/)[^&\\n]+#', $row->object_content, $preg);
$embed = '<iframe width="560" height="315" src="http://www.youtube.com/embed/' . $preg[0] . '" frameborder="0" allowfullscreen></iframe>';
$_row = array('ID' => $row->object_id, 'BIO' => $row->object_bio, 'SUBJECT' => $row->object_subject, 'CONTENT' => $row->object_content, 'VIDEO' => $preg[0], 'EMBED' => !$i ? $embed : '<a href="' . _link('tv', array('v' => $row->object_id)) . '" class="thumbnail"><img src="http://i2.ytimg.com/vi/' . $preg[0] . '/default.jpg" alt=""><br /><h5>' . $row->object_subject . '</h5></a>', 'EMBED2' => !$i ? $embed : '<img src="http://i2.ytimg.com/vi/' . $preg[0] . '/default.jpg" alt="" width="140" height="140" rel="' . _link('tv', array('v' => $row->object_id)) . '" />', 'EMBED3' => !$i ? $embed : '<a href="' . _link('tv', array('v' => $row->object_id)) . '"><img src="http://i2.ytimg.com/vi/' . $preg[0] . '/default.jpg" alt="" width="140" height="140"></a>', 'SPAN' => !$i ? 'span6' : 'span2', 'TIME' => $bio->format_date($row->object_time));
_style('tv.row', array_merge($_row, $this->_profile($row)));
}
$sql = 'SELECT *
FROM _objects_rel_type
ORDER BY type_alias';
$rel_type = sql_rowset($sql);
foreach ($rel_type as $i => $row) {
if (!$i) {
_style('rel_type', array('TV_URL' => _link('tv')));
}
$row->type_alias = _link('tv', array('r' => $row->type_alias));
_style('rel_type.row', $row);
}
return;
}
示例9: home
public function home()
{
global $core, $bio;
$v = $this->__(array_merge(w('a r'), _array_keys(w('s'), 0)));
if (!empty($v->a)) {
}
if (!empty($v->r)) {
$sql = 'SELECT *
FROM _objects o, _objects_type t, _bio b, _objects_rel_assoc ra, _objects_rel_type rt
WHERE t.type_alias = ?
AND rt.type_alias = ?
AND o.object_bio = b.bio_id
AND ra.assoc_object = o.object_id
AND ra.assoc_rel_type = rt.type_id
ORDER BY o.object_time
LIMIT ??, ??';
$news = sql_rowset(sql_filter($sql, 'news', $v->r, $v->s, $core->v('objects_per_page')));
$sql = 'SELECT COUNT(object_id) AS total
FROM _objects o, _objects_type t, _objects_rel_assoc ra, _objects_rel_type rt
WHERE t.type_alias = ?
AND rt.type_alias = ?
AND ra.assoc_object = o.object_id
AND ra.assoc_rel_type = rt.type_id';
$news_total = sql_field(sql_filter($sql, 'news', $v->r), 'total', 0);
} else {
$sql = 'SELECT *
FROM _objects o, _objects_type t, _bio b
WHERE t.type_alias = ?
AND o.object_type = t.type_id
AND o.object_bio = b.bio_id
ORDER BY o.object_time
LIMIT ??, ??';
$news = sql_rowset(sql_filter($sql, 'news', $v->s, $core->v('objects_per_page')));
$sql = 'SELECT COUNT(object_id) AS total
FROM _objects o, _objects_type t
WHERE t.type_alias = ?
AND o.object_type = t.type_id';
$news_total = sql_field(sql_filter($sql, 'news'), 'total', 0);
}
foreach ($news as $i => $row) {
if (!$i) {
_style('news', _pagination(_link('news'), 's:%d', $news_total + 1, $core->v('objects_per_page'), $v->s));
}
$_row = array('ID' => $row->object_id, 'BIO' => $row->object_bio, 'SUBJECT' => $row->object_subject, 'CONTENT' => _message($row->object_content), 'TIME' => $bio->format_date($row->object_time));
_style('news.row', array_merge($_row, $this->_profile($row)));
}
$sql = 'SELECT *
FROM _objects_rel_type
ORDER BY type_alias';
$rel_type = sql_rowset($sql);
foreach ($rel_type as $i => $row) {
if (!$i) {
_style('rel_type', array('NEWS_URL' => _link('news')));
}
$row->type_alias = _link('news', array('r' => $row->type_alias));
_style('rel_type.row', $row);
}
return;
}
示例10: _home
public function _home() {
global $config, $cache, $user;
if (!_button()) {
$sql = 'SELECT cat_id, cat_name
FROM _news_cat
ORDER BY cat_id';
$result = sql_rowset($sql);
foreach ($result as $i => $row) {
if (!$i) _style('categories');
_style('categories.row', array(
'CAT_ID' => $row['cat_id'],
'CAT_NAME' => $row['cat_name'])
);
}
return false;
}
$t = request_var('news_id', 0);
$f = request_var('cat_id', 0);
if (!$f || !$t) {
fatal_error();
}
//
$sql = 'SELECT *
FROM _news
WHERE news_id = ?';
if (!$tdata = sql_fieldrow(sql_filter($sql, $t))) {
fatal_error();
}
//
$sql = 'SELECT *
FROM _news_cat
WHERE cat_id = ?';
if (!$fdata = sql_fieldrow(sql_filter($sql, $f))) {
fatal_error();
}
//
$sql = 'UPDATE _news SET cat_id = ?
WHERE news_id = ?';
sql_query(sql_filter($sql, $f, $t));
return redirect(s_link('news', $t));
}
示例11: elements
private function elements() {
$sql = 'SELECT *
FROM _win
ORDER BY win_date';
$win = sql_rowset($sql);
foreach ($win as $i => $row) {
if (!$ui) _style('win');
_style('win.row', array(
));
}
return;
}
示例12: _home
public function _home() {
global $config, $user, $cache;
if (_button()) {
$topic = request_var('topic', 0);
$sql = 'SELECT *
FROM _forum_topics
WHERE topic_id = ?';
if (!$topicdata = sql_fieldrow(sql_filter($sql, $topic))) {
fatal_error();
}
$sql = 'UPDATE _forum_topics
SET topic_color = ?, topic_announce = 0, topic_important = 0
WHERE topic_id = ?';
sql_query(sql_filter($sql, '', $topic));
_style('updated', array(
'MESSAGE' => 'El tema <strong>' . $topicdata['topic_title'] . '</strong> ha sido normalizado.')
);
}
$sql = 'SELECT t.topic_id, t.topic_title, f.forum_name
FROM _forums f, _forum_topics t
WHERE f.forum_id = t.forum_id
AND (topic_announce = 1
OR topic_important = 1)
ORDER BY forum_order, topic_title';
$topics = sql_rowset($sql);
$forum_name = '';
foreach ($topics as $i => $row) {
if (!$i) _style('topics');
if ($forum_name != $row['forum_name']) _style('topics.forum', array('FORUM_NAME' => $row['forum_name']));
$forum_name = $row['forum_name'];
_style('topics.forum.row', array(
'TOPIC_ID' => $row['topic_id'],
'TOPIC_TITLE' => $row['topic_title'])
);
}
return;
}
示例13: _home
public function _home() {
global $config, $user, $cache;
$limit = 225;
$steps = 0;
$items = 0;
$trash = w();
//
$sql = "SELECT *
FROM _members
WHERE user_type NOT IN (??)
AND user_email <> ''
AND user_id NOT IN (
SELECT ban_userid
FROM _banlist
WHERE ban_userid <> 0
)
ORDER BY username";
$result = sql_rowset(sql_filter($sql, USER_INACTIVE));
foreach ($result as $row) {
if (!preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*?[a-z]+$/is', $row['user_email'])) {
$trash[] = $row['user_email'];
continue;
}
if (!$items || $items == $limit) {
$items = 0;
$steps++;
_style('step', array(
'STEPS' => $steps)
);
}
_style('step.item', array(
'USERNAME' => $row['username'],
'USER_EMAIL' => $row['user_email'])
);
$items++;
}
return;
}
示例14: run
public function run() {
$sql = 'SELECT *
FROM _awards_type
ORDER BY type_order';
$types = sql_rowset($sql);
foreach ($types as $i => $row) {
if (!$i) _style('awards');
_style('awards.row', array(
'NAME' => $row['type_name'],
'DESC' => $row['type_desc'])
);
}
return;
}
示例15: home
public function home()
{
$now = time();
$sql = 'SELECT *
FROM _contest
WHERE contest_start > ??
AND contest_end < ??
ORDER BY contest_start';
$contest = sql_rowset(sql_filter($sql, $now, $now));
foreach ($contest as $i => $row) {
if (!$i) {
_style('contest');
}
_style('contest.row', array('URL' => _link('contest', $row->contest_alias), 'SUBJECT' => $row->contest_subject, 'END' => _format_date($row->contest_end)));
}
return;
}