本文整理汇总了PHP中rex_sql::select方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_sql::select方法的具体用法?PHP rex_sql::select怎么用?PHP rex_sql::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_sql
的用法示例。
在下文中一共展示了rex_sql::select方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkEntrys
/**
* check if entrys exists for the addon
* @return bool
*/
public static function checkEntrys()
{
global $REX;
$sql = new rex_sql();
$sql->setTable($REX['TABLE_PREFIX'] . 'url_control_generate');
$sql->setWhere('`table` = "' . rex_asd_news_config::getTable() . '"');
$sql->select('1');
return (bool) $sql->getRows();
}
示例2: isCached
/**
* Returns if a search term is already cached.
* The cached result will be stored in $this->cachedArray.
*
* @param string $_search
*
* @return bool
*/
function isCached($_search)
{
$sql = new rex_sql();
$sql->setTable($this->tablePrefix . '587_searchcache');
$sql->setWhere(sprintf("hash = '%s'", $this->cacheHash($_search)));
if ($sql->select('returnarray')) {
foreach ($sql->getArray() as $value) {
return false !== ($this->cachedArray = unserialize($value['returnarray']));
}
}
return false;
}
示例3: DateTime
$id = rex_request('id', 'int', 0);
$clang = rex_request('clang', 'int', 0);
$now = new DateTime();
$urlParam = '&subpage=' . $subpage;
if ($func) {
$urlParam .= '&func=' . $func;
}
if ($id) {
$urlParam .= '&id=' . $id;
}
rex_asd_news_language($clang, $urlParam);
if ($func == 'status') {
$sql = new rex_sql();
$sql->setTable(rex_asd_news_config::getTable());
$sql->setWhere('id=' . $id . ' AND clang = ' . $clang);
$sql->select('`status`');
$status = $sql->getValue('status') ? 0 : 1;
$sql->setTable(rex_asd_news_config::getTable());
$sql->setWhere('id=' . $id . ' AND clang = ' . $clang);
$sql->setValue('status', $status);
if ($sql->update()) {
echo rex_info($I18N->msg('asd_news_status_saved'));
} else {
echo rex_warning($sql->getError());
}
$func = '';
}
if ($func == 'delete') {
$sql = new rex_sql();
$sql->setTable(rex_asd_news_config::getTable());
$sql->setWhere('id=' . $id . ' AND clang = ' . $clang);
示例4: saveOverLangValues
/**
* @param rex_news_form $form
* @param $id
* @param $clang
*/
public static function saveOverLangValues(rex_news_form $form, $id, $clang)
{
global $REX;
$lang = new rex_sql();
$lang->setQuery('SELECT `id` FROM `' . $REX['TABLE_PREFIX'] . 'clang` WHERE `id` != ' . $clang);
for ($i = 1; $i <= $lang->getRows(); $i++) {
$sql = new rex_sql();
$sql->setTable($form->getTableName());
$sql->setDebug(true);
$sql->setWhere('`id` = ' . $id . ' AND `clang` = ' . $lang->getValue('id'));
$sql->select('id');
$sql->setTable($form->getTableName());
$sql->setDebug(true);
$sql->setWhere('`id` = ' . $id . ' AND `clang` = ' . $lang->getValue('id'));
if (OOAddon::isAvailable('metainfo')) {
$sql->setValues($form->getMetaValues());
}
if ($sql->getRows()) {
$sql->setValues(array_intersect_key($form->getValues(), array_flip($form->getOverSavedFields())));
$sql->setValue('clang', $lang->getValue('id'));
$sql->setValue('id', $id);
$sql->update();
} else {
$sql->setValues($form->getValues());
$sql->setValue('clang', $lang->getValue('id'));
$sql->setValue('id', $id);
$sql->insert();
}
$lang->next();
}
}
示例5: COUNT
$sql->setQuery("SELECT COUNT(*) AS count FROM `" . $sql->escape($table) . "`");
$count = intval($sql->getValue('count'));
$step_width = 100;
for ($i = 0; $i < $count; $i += $step_width) {
foreach ($columnArray as $column) {
#$js_output .= 'index("col",new Array("'.$table.'","'.$column.'"));';
$js_output .= 'indexArray.push(new Array("col",new Array("' . $table . '","' . $column . '",' . $i . ',' . $step_width . ')));';
$globalcount++;
}
}
}
}
if (!empty($REX['ADDON']['settings']['rexsearch']['indexmediapool']) and intval($REX['ADDON']['settings']['rexsearch']['indexmediapool'])) {
$mediaSQL = new rex_sql();
$mediaSQL->setTable($REX['TABLE_PREFIX'] . 'file');
if ($mediaSQL->select('file_id, category_id, filename')) {
foreach ($mediaSQL->getArray() as $file) {
if (!empty($REX['ADDON']['settings']['rexsearch']['fileextensions'])) {
// extract file-extension
$filenameArray = explode('.', $file['filename']);
$fileext = $filenameArray[count($filenameArray) - 1];
// check file-extension
if (!in_array($fileext, $REX['ADDON']['settings']['rexsearch']['fileextensions'])) {
continue;
}
}
#$js_output .= 'index("mediapool",new Array("'.urlencode($file['filename']).'","'.urlencode($file['file_id']).'","'.urlencode($file['category_id']).'"));';
$js_output .= 'indexArray.push(new Array("mediapool",new Array("' . urlencode($file['filename']) . '","' . urlencode($file['file_id']) . '","' . urlencode($file['category_id']) . '")));';
$globalcount++;
}
}