本文整理汇总了PHP中sql::getRows方法的典型用法代码示例。如果您正苦于以下问题:PHP sql::getRows方法的具体用法?PHP sql::getRows怎么用?PHP sql::getRows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sql
的用法示例。
在下文中一共展示了sql::getRows方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rex_opf_sync
function rex_opf_sync()
{
global $REX;
// abgleich der replacevalue felder..
$s = new sql();
// $s->debugsql = 1;
$s->setQuery("select clang, replacename, name, count(replacename) from rex_opf_lang group by replacename");
for ($i = 0; $i < $s->getRows(); $i++) {
if (count($REX['CLANG']) != $s->getValue("count(replacename)")) {
reset($REX['CLANG']);
while (list($key, $val) = each($REX['CLANG'])) {
$lclang = $key;
$replacename = $s->getValue("replacename");
$name = $s->getValue("name");
$gs = new sql();
$gs->setQuery("select clang from rex_opf_lang where clang={$lclang} and replacename='{$replacename}'");
if ($gs->getRows() == 0) {
// erstelle
$us = new sql();
$us->setTable("rex_opf_lang");
$us->setValue("clang", $lclang);
$us->setValue("replacename", $replacename);
$us->setValue("name", $name);
$us->insert();
}
}
}
$s->next();
}
}
示例2: rex_glossar_replace
/**
* Glossar Addon
* <
* @author staab[at]public-4u[dot]de Markus Staab
* @author <a href="http://www.public-4u.de">www.public-4u.de</a>
* @package redaxo3
* @version $Id: function_replace.inc.php,v 1.4 2008/01/25 09:48:36 kills Exp $
*/
function rex_glossar_replace($params)
{
global $REX, $mypage, $I18N_GLOSSAR;
$string = $params['subject'];
// Aufteilen des Strings, damit nur im Body ersetzt wird
$bodystart = strpos($string, '<body>');
$header = substr($string, 0, $bodystart);
$body = substr($string, $bodystart);
// Bereiche ersetzen, in denen keine Glossar ersetzungen durchgeführt werden sollen
// welche nicht innerhalb des Tags sind
$back_srch = array();
$back_rplc = array();
$mtchs = array();
if (preg_match_all('/(<textarea.*?>(.*?)<\\/textarea>)/s', $body, $mtchs)) {
foreach ($mtchs[2] as $key => $mtch) {
$back_srch[$key] = '###SPACER###' . $key . '###';
$back_rplc[$key] = $mtch;
$body = str_replace($mtch, '###SPACER###' . $key . '###', $body);
}
}
$sql = new sql();
//$sql->debugsql = true;
$sql->setQuery('SELECT * FROM rex_13_glossar, rex_13_glossar_lang WHERE language = lang_id ORDER BY CHAR_LENGTH(shortcut) DESC');
// IE doesnt support <abbr>
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
$replacetag = 'acronym';
} else {
$replacetag = 'abbr';
}
$replaceformat = '<' . $replacetag . ' class=\\"abbr\\" title=\\"%desc% (%lang%)\\">%short%</' . $replacetag . '>';
$searches = array();
$replaces = array();
for ($i = 0; $i < $sql->getRows(); $i++) {
$language = htmlspecialchars($sql->getValue('lang_name'));
$shortcut = htmlspecialchars($sql->getValue('shortcut'));
$description = htmlspecialchars($sql->getValue('description'));
$casesense = $sql->getValue('casesense');
// Escape Shortcut for preg_match
$escapedshortcut = preg_quote($shortcut, '/');
$escapedentitiesshortuct = htmlentities($escapedshortcut);
if ($escapedentitiesshortuct == $escapedshortcut) {
$search = '/((<[^>]*)|' . $escapedshortcut . ')/e';
} else {
$search = '/((<[^>]*)|' . $escapedshortcut . '|' . $escapedentitiesshortuct . ')/e';
}
$replacer = _rex_glossar_parse_replace_format($replaceformat, array('lang' => $language, 'desc' => $description, 'short' => $shortcut));
$replace = '"\\2"=="\\1" && strpos( "\\1", "<' . $replacetag . '>") === false ? "\\1":"' . $replacer . '"';
if ($casesense == 0) {
$search .= 'i';
}
$searches[] = $search;
$replaces[] = $replace;
$sql->next();
}
// Ersetzungen durchführen
$body = stripslashes(preg_replace($searches, $replaces, $body));
// Vorher ausgeschlossene Bereiche wieder einpflegen
$body = str_replace($back_srch, $back_rplc, $body);
return $header . $body;
}
示例3: sql
function glossar_replace($string)
{
global $REX, $mypage;
$I18N_GLOSSAR = new i18n($REX[LANG], $REX[INCLUDE_PATH] . "/addons/{$mypage}/lang/");
// CREATE LANG OBJ FOR THIS ADDON
$sql = new sql();
$sql->setQuery("select * from rex__glossar order by shortcut");
for ($i = 0; $i < $sql->getRows(); $i++) {
$language = $sql->getValue("language");
if ($language == "0") {
$language = $I18N_GLOSSAR->msg('lang_de_short');
} elseif ($language == "1") {
$language = $I18N_GLOSSAR->msg('lang_en_short');
} else {
$language = $I18N_GLOSSAR->msg('lang_fr_short');
}
$id = $sql->getValue("short_id");
$shortcut = htmlentities($sql->getValue("shortcut"));
$escapedshortcut = str_replace('.', '\\.', $shortcut);
$description = htmlentities($sql->getValue("description"));
$language = trim($language);
$casesense = $sql->getValue("casesense");
$search = "/((<[^>]*)|{$escapedshortcut})/e";
$replace = '"\\2"=="\\1"? "\\1":"<span lang=\\"' . $language . '\\" xml:lang=\\"' . $language . '\\" title=\\"' . $language . ': ' . $description . '\\" class=\\"shortcut\\">' . $shortcut . '</span>"';
$subject = $string;
if ($casesense == 0) {
$search .= 'i';
}
$string = preg_replace($search, $replace, $subject);
$sql->counter++;
}
return $string;
}
示例4: sql
function rex_opf($params)
{
global $REX;
$content = $params['subject'];
$gv = new sql();
// $gv->debugsql = 1;
$gv->setQuery("select * from rex_opf_lang where clang='" . $REX['CUR_CLANG'] . "'");
for ($i = 0; $i < $gv->getRows(); $i++) {
$content = str_replace($gv->getValue("replacename"), $gv->getValue("name"), $content);
$gv->next();
}
return $content;
}
示例5: get
/**
* Gibt den HTML Content zurück
*/
function get()
{
$table = $this->getTable();
$field = $this->getField();
$foreignField = $this->getForeignField();
$value = $this->formatValue();
$qry = 'SELECT ' . $field . ' FROM ' . $table . ' WHERE ' . $foreignField . ' = "' . $value . '"';
$sql = new sql();
// $sql->debugsql = true;
$sql->setQuery($qry);
if ($sql->getRows() == 1) {
return $sql->getValue($field);
}
return '';
}
示例6: enterObject
function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
{
foreach ($email_elements as $k => $v) {
if ($this->elements[3] == $k) {
$value = $v;
}
}
$gd = new sql();
// $gd->debugsql = 1;
$gd->setQuery('select * from ' . $this->elements[1] . ' where ' . $this->elements[2] . '="' . addslashes($v) . '"');
if ($gd->getRows() == 1) {
$ar = $gd->get_array();
foreach ($ar[0] as $k => $v) {
$email_elements[$k] = $v;
}
}
return;
}
示例7: getArticlesByType
function getArticlesByType($article_type_id, $ignore_offlines = false, $clang = false)
{
global $REX;
if ($clang === false) {
$clang = $REX[CUR_CLANG];
}
$offline = $ignore_offlines ? " and status = 1 " : "";
$artlist = array();
$sql = new sql();
$sql->setQuery("select " . implode(',', OORedaxo::getClassVars()) . " FROM rex_article WHERE type_id = '{$article_type_id}' AND clang='{$clang}' {$offline}");
for ($i = 0; $i < $sql->getRows(); $i++) {
foreach (OORedaxo::getClassVars() as $var) {
$article_data['_' . $var] = $sql->getValue($var);
}
$artlist[] = new OOArticle($article_data);
$sql->next();
}
return $artlist;
}
示例8: stat
function stat()
{
$this->MAIN['stamp'] = array();
$this->MAIN['ip'] = array();
$this->MAIN['pageviews'] = array();
// which pages in an array under this one
$this->MAIN['useragent'] = array();
$this->MAIN['hostname'] = array();
$this->MAIN['referer'] = array();
$this->BROWSER['type'] = array();
$this->BROWSER['os'] = array();
$this->REFERER = array();
$this->SEARCH['engine'] = array();
$this->SEARCH['words'] = array();
$this->evalshows = array("REX_EVAL_DAY", "REX_EVAL_MONTH", "REX_EVAL_ALLARTICLE", "REX_EVAL_TOP10ARTICLE", "REX_EVAL_WORST10ARTICLE", "REX_EVAL_LAENDER", "REX_EVAL_SUCHMASCHINEN", "REX_EVAL_REFERER", "REX_EVAL_BROWSER", "REX_EVAL_OPERATINGSYSTEM", "REX_EVAL_SEARCHWORDS");
$this->evalsnipps = array();
$statartikel = new sql();
$statartikel->setQuery("SELECT id,name FROM rex_article");
for ($i = 0; $i < $statartikel->getRows(); $i++) {
$this->ART[$statartikel->getValue("id")] = $statartikel->getValue("name");
$statartikel->next();
}
}
示例9: select
// ----------------------------- / FILE UPLOAD
$meta_sql->update();
$article->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where id='{$article_id}' and clang='{$clang}'");
if (!isset($message)) {
$message = '';
}
$err_msg = $I18N->msg("metadata_updated") . $message;
rex_generateArticle($article_id);
}
$typesel = new select();
$typesel->set_name("type_id");
$typesel->set_style("width:100%;");
$typesel->set_size(1);
$typesql = new sql();
$typesql->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article_type order by name");
for ($i = 0; $i < $typesql->getRows(); $i++) {
$typesel->add_option($typesql->getValue("name"), $typesql->getValue("type_id"));
$typesql->next();
}
$typesel->set_selected($article->getValue("type_id"));
// Artikeltyp-Auswahl nur anzeigen, wenn mehr als ein Typ vorhanden ist
if ($typesql->getRows() <= 1) {
$out = "<input type=hidden name=type_id value=0>";
} else {
$out = "<tr><td class=grey>" . $I18N->msg("article_type_list_name") . "</td><td class=grey>" . $typesel->out() . "</td></tr>";
}
echo " <table border=0 cellpadding=5 cellspacing=1 width=100%>\n <form action=index.php method=post ENCTYPE=multipart/form-data name=REX_FORM>\n <input type=hidden name=page value=content>\n <input type=hidden name=article_id value='{$article_id}'>\n <input type=hidden name=mode value='meta'>\n <input type=hidden name=save value=1>\n <input type=hidden name=clang value={$clang}>\n <input type=hidden name=ctype value={$ctype}>\n <tr>\n <td colspan=2>" . $I18N->msg("general") . "</td>\n </tr>";
if (isset($err_msg) and $err_msg != "") {
echo '<tr><td colspan="2" class="warning"><font class="warning">' . $err_msg . '</font></td></tr>';
}
function selectdate($date, $extens)
示例10: deleteMessage
function deleteMessage($message_id)
{
// reply
$r_sql = new sql();
$r_sql->setQuery("select * from rex_5_board where message_id='{$message_id}' and board_id='" . $this->boardname . "'");
if ($r_sql->getRows() == 1) {
if ($r_sql->getValue("re_message_id") != 0) {
// reply
$ur_sql = new sql();
$ur_sql->setTable("rex_5_board");
$ur_sql->where("message_id='{$message_id}'");
$ur_sql->setValue("status", 0);
$ur_sql->update();
$message_id = $r_sql->getValue("re_message_id");
// update topic
$u_sql = new sql();
$u_sql->setQuery("select * from rex_5_board where re_message_id='{$message_id}' and status='1'");
$u_sql->setTable("rex_5_board");
$u_sql->where("message_id='{$message_id}'");
$u_sql->setValue("replies", $u_sql->getRows());
$u_sql->update();
$this->msg["bb_msg_id"] = $r_sql->getValue("re_message_id");
$return = $this->showMessage();
} else {
// topic
$u_sql = new sql();
$u_sql->setTable("rex_5_board");
$u_sql->where("message_id='{$message_id}' or re_message_id='{$message_id}'");
$u_sql->setValue("status", 0);
$u_sql->update();
$this->errmsg = $this->text[250];
$return = $this->showMessages();
}
} else {
$this->errmsg = $this->text[260];
$return = $this->showMessages();
}
return $return;
}
示例11: sql
<?php
echo "<table border=0 cellpadding=0 cellspacing=0 width=770 ><tr><td class=grey><br>";
$boards = new sql();
$boards->setQuery("select distinct board_id from rex_5_board");
if ($boards->getRows() > 0) {
$currentboardname = "";
echo "<table border=0 cellpadding=5 cellspacing=1 width=100%>";
for ($i = 0; $i < $boards->getRows(); $i++) {
$boardname = $boards->getValue("board_id");
echo "<tr><td class=dgrey><b><a href=index.php?page=community&subpage=board&FORM[boardname]={$boardname} class=black>{$boardname}</a></b></td></tr>";
if ($FORM[boardname] == $boardname) {
$currentboardname = $boardname;
}
$boards->next();
}
echo "</table><br>";
if ($currentboardname != "") {
$board = new rex_com_board();
$board->addLink("page", "community");
$board->addLink("subpage", "board");
$board->setBoardname($currentboardname);
// $board->setUserjoin("rex_2_user on rex_5_board.user_id=rex_2_user.id","rex_2_user.login");
$board->setAdmin();
$board->setAnonymous(true);
echo $board->showBoard();
}
} else {
echo " Kein Board wurde eingetragen !<br>";
}
echo "<br></td></tr></table>";
示例12: generateCategoryList
function generateCategoryList($re_id)
{
global $REX;
$GC = new sql();
$GC->setQuery("select *\r\n\t\t\tfrom rex_category as cat1\r\n\t\t\tleft join rex_article on cat1.id=rex_article.category_id\r\n\t\t\twhere\r\n\t\t\tcat1.re_category_id='{$re_id}' and\r\n\t\t\tcat1.id=rex_article.category_id and\r\n\t\t\trex_article.startpage=1\r\n\t\t\torder by cat1.prior,cat1.name");
$content = "<?";
for ($i = 0; $i < $GC->getRows(); $i++) {
$id = $GC->getValue("cat1.id");
$content .= "\r\n\$REX[RECAT][{$re_id}][] = \"" . $GC->getValue("cat1.id") . "\";\r\n\r\n\$REX[CAT][{$id}][name] = \"" . addslashes($GC->getValue("cat1.name")) . "\";\r\n\$REX[CAT][{$id}][re_category_id] = \"" . addslashes($GC->getValue("cat1.re_category_id")) . "\";\r\n\$REX[CAT][{$id}][category_id] = \"{$id}\";\r\n\$REX[CAT][{$id}][prior] = \"" . addslashes($GC->getValue("cat1.prior")) . "\";\r\n\$REX[CAT][{$id}][path] = \"" . addslashes($GC->getValue("cat1.path")) . "\";\r\n\$REX[CAT][{$id}][status] = \"" . addslashes($GC->getValue("cat1.status")) . "\";\r\n\$REX[CAT][{$id}][article_id] = \"" . addslashes($GC->getValue("rex_article.id")) . "\";\r\n\r\n";
$GC->next();
}
$content .= "?>";
$fp = fopen($REX[INCLUDE_PATH] . "/generated/categories/" . $re_id . ".list.category", "w");
fputs($fp, $content);
fclose($fp);
}
示例13: generateAll
function generateAll()
{
global $REX, $I18N;
// ----------------------------------------------------------- generiere templates
deleteDir($REX[INCLUDE_PATH] . "/generated/templates", 0);
// mkdir($REX[INCLUDE_PATH]."/generated/templates",0664);
$gt = new sql();
$gt->setQuery("select * from rex_template");
for ($i = 0; $i < $gt->getRows(); $i++) {
$fp = fopen($REX[INCLUDE_PATH] . "/generated/templates/" . $gt->getValue("rex_template.id") . ".template", "w");
fputs($fp, $gt->getValue("rex_template.content"));
fclose($fp);
$gt->next();
}
// ----------------------------------------------------------- generiere artikel
deleteDir($REX[INCLUDE_PATH] . "/generated/articles", 0);
// mkdir($REX[INCLUDE_PATH]."/generated/articles",0664);
$gc = new sql();
$gc->setQuery("select * from rex_article");
for ($i = 0; $i < $gc->getRows(); $i++) {
generateArticle($gc->getValue("id"));
$gc->next();
}
// ----------------------------------------------------------- generiere categorien
deleteDir($REX[INCLUDE_PATH] . "/generated/categories", 0);
// mkdir($REX[INCLUDE_PATH]."/generated/categories",0664);
$gcc = new sql();
$gcc->setQuery("select * from rex_category");
for ($i = 0; $i < $gcc->getRows(); $i++) {
generateCategory($gcc->getValue("id"));
$gcc->next();
}
// generateCategories();
$MSG = $I18N->msg('articles_generated') . " " . $I18N->msg('old_articles_deleted');
return $MSG;
}
示例14: read
function read()
{
global $REX;
$sql = new sql();
// $sql->debugsql = true;
$sql->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . '51_cache_article WHERE article_id=' . $this->article_id . ' AND clang=' . $this->clang);
$this->vars = array();
if ($sql->getRows() > 0) {
$result = $sql->get_array();
$this->vars = $result[0];
}
}
示例15: converDescription
echo '<br />' . nl2br(htmlspecialchars($file_description)) . '<br /><br />' . $file_stamp . '|' . $file_updateuser . '</td>' . "\n";
echo ' <td valign="top" class="grey">' . $opener_link . '</td>' . "\n";
echo '</tr>' . "\n\n";
$files->next();
}
if ($files->getRows() == 0) {
// ----- no items found
// print "<tr><td colspan=5> </td>";
print "<tr>\r\n <td class=grey align=center> </td>\r\n <td class=grey colspan=3>" . $I18N->msg('pool_nomediafound') . "</td>\r\n </tr>";
} elseif ($PERMALL) {
print "</table>";
print "<table class=rex border=0 cellpadding=5 cellspacing=1 style='width:100%'>\n";
// ----- move and delete selected items
print "<tr>\r\n <td align=center class=icon><!-- " . $I18N->msg('pool_select_all') . " --><input type=checkbox name=checkie value=0 onClick=\"SetAllCheckBoxes('rex_file_list','selectedmedia[]',this)\"></td>";
$filecat = new sql();
$filecat->setQuery("SELECT * FROM " . $REX['TABLE_PREFIX'] . "file_category ORDER BY name ASC LIMIT 1");
if ($filecat->getRows() > 0) {
print "\r\n <!-- <td class=grey><b>" . $I18N->msg('pool_selectedmedia') . "</b> </td>-->\r\n <td class=grey>" . $cats_sel->out() . "</td>\r\n <td class=grey><input type=submit value=\"" . $I18N->msg('pool_changecat_selectedmedia') . "\" onclick=\"document.rex_file_list.media_method.value='updatecat_selectedmedia';\"></td>\r\n <td class=grey width=150><input type=submit value=\"" . $I18N->msg('pool_delete_selectedmedia') . "\" onclick=\"document.rex_file_list.media_method.value='delete_selectedmedia';return confirm('" . $I18N->msg('delete') . " ?');\"></td>\r\n ";
} else {
print "\r\n <td class=grey> </td>\r\n <td class=grey width=150><input type=submit value=\"" . $I18N->msg('pool_delete_selectedmedia') . "\" onclick=\"document.rex_file_list.media_method.value='delete_selectedmedia';return confirm('" . $I18N->msg('delete') . " ?');\" ></td>\r\n ";
}
print "</tr>";
}
print "</form>";
print "</table>";
}
echo "</body></html>";
function converDescription($description)
{
return htmlspecialchars($description);
}