本文整理汇总了PHP中SQL::cmdrows方法的典型用法代码示例。如果您正苦于以下问题:PHP SQL::cmdrows方法的具体用法?PHP SQL::cmdrows怎么用?PHP SQL::cmdrows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQL
的用法示例。
在下文中一共展示了SQL::cmdrows方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loginload
public static function loginload($id)
{
$db = new SQL(0);
$row = $db->cmdrow(0, 'SELECT * FROM user_list WHERE id="{0}" LIMIT 0,1', array($id));
$_SESSION["myuser"]["id"] = $row["id"];
$_SESSION["myuser"]["username"] = $row["username"];
$rows = $db->cmdrows(0, 'SELECT * FROM user_rights WHERE `user` = {0}', array($row["id"]));
$w = array();
$w["user"] = MyUser::id();
$w["last_action"] = time();
$db->CreateUpdate(0, 'user_action', $w);
foreach ($rows as $a) {
$_SESSION["myuser"]["rights"][$a["right"]] = true;
}
}
示例2: tnquestion
public static function tnquestion($data)
{
$db = new SQL(0);
$out = array();
$rows = $db->cmdrows(0, 'SELECT *,MATCH (title,question,tags) AGAINST ("{0}") as Score FROM questions WHERE MATCH (title,question,tags) AGAINST ("{0}") ORDER BY Score DESC LIMIT 0,10', array($data["term"]));
foreach ($rows as $row) {
$b = array();
$b["label"] = $row["title"];
$b["value"] = $row["title"];
$b["type"] = "question";
$b["score"] = $row["Score"] + 0;
$out[] = $b;
}
return $out;
}
示例3: Release
public static function Release($question = 0, $Receiver_User = 0)
{
$db = new SQL(0);
$rows = $db->cmdrows(0, 'SELECT * FROM question_bounty WHERE question={0} GROUP BY currency', array($question + 0));
foreach ($rows as $row) {
switch ($row["currency"]) {
case "kar":
Karma::add($Receiver_User, 6, $row["amount"], $row["question"]);
break;
case "BTC":
break;
case "EUR":
break;
default:
}
}
$db->cmd(0, 'UPDATE questions SET is_bounty =0 WHERE question={0} LIMIT 1', true, array($question + 0));
$db->cmd(0, 'DELETE FROM question_bounty WHERE question={0}', true, array($question + 0));
}
示例4: wiky
<?php
if (isset($_GET["antispam"]) and $_GET["antispam"] == "img") {
PageEngine::runController("ask_antispam");
}
if (isset($_POST["action"]) and $_POST["action"] == "preview") {
$wiky = new wiky();
$out = array();
$out["html"] = $wiky->parse($_POST["text"]);
echo json_encode($out);
exit(1);
}
if (isset($_POST["action"]) and $_POST["action"] == "possiblequestions") {
$db = new SQL(0);
$rows = $db->cmdrows(0, 'SELECT *,MATCH (title,question,tags) AGAINST ("{0}") as Score FROM questions WHERE MATCH (title,question,tags) AGAINST ("{0}") ORDER BY Score DESC LIMIT 0,10', array($_POST["q"]));
echo '<div><b>Schon gestellte ähnliche Fragen...</b><ul style="list-style:none;">';
foreach ($rows as $row) {
echo '<li><a href="' . Question::PermalinkByData($row["id"], $row["title"]) . '">' . html($row["title"]) . '</a></li>';
}
echo '</ul></div>';
exit(1);
}
if (isset($_POST["action"]) and $_POST["action"] == "save") {
$db = new SQL(0);
$j = true;
$tags = array();
if (!MyUser::isloggedin()) {
if (!isset($_POST["antispam"]) or $_POST["antispam"] . "" == "") {
PageEngine::AddErrorMessage("AnswerNew", "Bitte lesen Sie die Buchstaben unten im Antispam!");
$j = false;
}
示例5: _e
<?php
$db = new SQL(0);
$rows = $db->cmdrows(0, 'SELECT * FROM user_notification WHERE user = {0}', array(MyUser::id() + 0));
if (count($rows) > 0) {
echo '<div class="notify"><a class="BtnCloseNotify" TITLE="' . _e("close") . '"></a>';
foreach ($rows as $row) {
echo '<p class="notification">' . html(Notification::write($row["msgid"], array("question" => $row["ref_question"], "answer" => $row["ref_answer"], "user" => $row["ref_user"]))) . '</p>';
}
echo '</div>';
}
?>
<header>
<div class="content-wrapper">
<a class="logo" href="<?php
echo $_ENV["baseurl"];
?>
" TITLE="<?php
echo _e("back to home");
?>
"><img src="<?php
echo $_ENV["baseurl"];
?>
skins/default/images/logo.png"/></a>
<div class="userToolsNav">
<?php
if (MyUser::isloggedin()) {
?>
<a class="user" href="<?php
echo MyUser::getProfileURL();
示例6: html
<?php
$db = new SQL(0);
$info = $db->cmdrow(0, 'SELECT * FROM questions WHERE id={0} LIMIT 0,1', array($params["id"]));
$versions = $db->cmdrows(0, 'SELECT * FROM qatext_versions WHERE type="q" AND keyid="{0}" ORDER BY dt_created ASC', array($info["id"] + 0));
PageEngine::html("html_head");
PageEngine::html("header");
?>
<div id="Content" class="content-wrapper PageQuestionEdit">
<article class="ContentLeft">
<h1>Frage bearbeiten [<a href="<?php
echo Question::PermalinkByData($info["id"], $info["title"]);
?>
">zurück</a>]</h1>
<SELECT name="revision">
<?php
foreach ($versions as $row) {
echo '<OPTION value="V' . $row["id"] . '">Sicherung vom ' . date("d.m.Y H:i:s", $row["dt_created"]) . ' Uhr</OPTION>';
}
?>
<OPTION value="current">Aktuelle Version</OPTION>
</SELECT><button id="BtnLoadRevision" type="button" DISABLED="DISABLED">laden</button>
<form method="POST"><INPUT type="hidden" name="action" value="save"/>
<b>Titel:</b>
<INPUT class="gblue" type="text" name="title" value="<?php
echo html($info["title"]);
?>
"/>
<p><?php
示例7: _e
<?php
$db = new SQL(0);
$info = $db->cmdrow(0, 'SELECT T1.*,T2.*,T3.right FROM user_list as T1 LEFT JOIN user_action as T2 ON T1.id=T2.user LEFT JOIN user_rights as T3 ON T1.id=T3.user AND T3.right="expert" WHERE T1.id={0} LIMIT 0,1', array($params["user_id"]));
$badges = $db->cmdrows(0, 'SELECT *, count(*) as Anzahl FROM user_badges WHERE user="{0}" GROUP BY badge ORDER BY dt_received DESC ', array($info["id"] + 0));
PageEngine::html("html_head", array("title" => $info["username"] . "'s Auszeichnungen"));
PageEngine::html("header");
?>
<div id="Content" class="content-wrapper PageUserBadges">
<article class="ContentLeft">
<h1 class="search-result-summary"><?php
echo _e("{0}'s Auszeichnungen", array(0 => html($info["username"])));
?>
</h1>
<?php
PageEngine::html("box_userprofile_navi", array("id" => $info["id"], "name" => $info["username"]));
?>
<table class="MedalTable">
<?php
foreach ($badges as $row) {
$b = Badges::$badgelist[$row["badge"]];
echo '<tr><td>';
echo '<img src="' . get_path("/skins/default/images/layout/yes.png") . '" height="32" TITLE="Sie haben bereits diese Auszeichnung"/>';
echo '</td><td><a href="' . get_path("/badges/" . $row["badge"] . "/" . html($b["title"])) . '" class="awardmedal"><span class="award' . $b["medal"] . '">' . html($b["title"]) . '</span></a></td>';
echo '<td>' . date("d.m.Y", $row["dt_received"]) . '</td>';
echo '<td class="desc">' . html($b["desc"]) . '</td>';
echo '</tr>';
}
?>
</table>
示例8: SpamText
<?php
$rss = new RSS("Letzte Antworten - " . SiteConfig::val("page/title", "Q/A Forum"), "Die neusten Antworten aus dem Forum", get_path("/questions/rss"));
$db = new SQL(0);
$rows = $db->cmdrows(0, 'SELECT T1.*,T3.title,T2.username as authorname FROM answers as T1 LEFT JOIN user_list as T2 ON T1.author=T2.id LEFT JOIN questions as T3 ON T1.question=T3.id WHERE 1 ORDER BY date_created DESC LIMIT 0,30');
foreach ($rows as $row) {
$item = new RSSItem("Antwort auf: " . $row["title"], $row["txt"] . '<br/><br/><div style="color:#8080ff;">SPAMcheck: ' . SpamText($row["isSPAM"]) . '<br/><i>' . html($row["authorname"]) . '</i></div>', Question::PermalinkByData($row["question"], $row["title"]) . "#answer-" . $row["id"]);
$rss->addItem($item);
}
//die($rss->fetch());
$rss->display();
exit(1);
function SpamText($v)
{
switch ($v) {
case -2:
return "Akismet gute Antwort";
case -1:
return "Ham";
case 1:
return "<b>Spam</b>";
case 2:
return "<b>Akismet SPAM</b>";
}
}
示例9: isset
<?php
if (isset($_GET["act"]) && $_GET["act"] == "autocompleteTags") {
$out = array();
$db = new SQL(0);
$rows = $db->cmdrows(0, 'SELECT tag, count(*) as Anzahl FROM question_tags WHERE tag LIKE "%{0}%" GROUP BY tag ORDER BY Anzahl DESC LIMIT 0,10', array($_REQUEST["term"]));
foreach ($rows as $row) {
$out[] = array("id" => $row["tag"], "label" => $row["tag"], "value" => $row["tag"]);
}
die(json_encode($out));
}
PageEngine::html("html_head", array("subtitle" => _h("ask your question"), "nocache" => true));
PageEngine::html("header");
?>
<style>
nav .searchBar { display: none;}
</style>
<div id="Content" class="content-wrapper askForm">
<article class="ContentLeft">
<?php
PageEngine::html("messagebox", array("name" => "save"));
?>
<form method="POST"><INPUT type="hidden" name="action" value="save"/>
<INPUT type="text" class="fld_title big" name="title" autocomplete="off" value="<?php
echo isset($_POST["title"]) ? html($_POST["title"]) : "";
?>
" placeholder="<?php
echo _e("Wie lautet Deine Frage?");
?>
"/>
<p><?php
示例10: get_path
<?php
$db = new SQL(0);
$rows = $db->cmdrows(0, 'SELECT T1.badge, count(*) as Anzahl, T2.user FROM user_badges as T1 LEFT JOIN user_badges as T2 ON T1.badge = T2.badge AND T2.user="{0}" GROUP BY T1.badge', array(MyUser::id() + 0));
$badges = array();
foreach ($rows as $row) {
$badges[$row["badge"]] = $row;
}
PageEngine::html("html_head");
PageEngine::html("header");
?>
<div id="Content" class="content-wrapper">
<article class="ContentLeft">
<h1>Auszeichnungen</h1>
<p>Rege Teilnahme mit qualitativ hochwertigen Fragen und Antworten führt zum Erhalt von Auszeichnungen in Form von Abzeichen.</p>
<p>Hier unten findest Du eine Liste der möglichen Auszeichnungen und die Häufigkeit, mit der das Abzeichen bisher verliehen wurde. Hast Du noch mehr Ideen für tolle Abzeichen? Dann gib uns bitte ein <a href="<?php
echo get_path("/feedback");
?>
" rel="nofollow" target="_blank">Feedback</a></p>
<table class="MedalTable">
<?php
foreach (Badges::$badgelist as $key => $value) {
echo '<tr><td>';
if (isset($badges[$key]["user"])) {
echo '<img src="' . get_path("/skins/default/images/layout/yes.png") . '" height="32" TITLE="Sie haben bereits diese Auszeichnung"/>';
}
echo '</td><td><a href="' . get_path("/badges/" . $key . "/" . html($value["title"])) . '" class="awardmedal"><span class="award' . $value["medal"] . '">' . html($value["title"]) . '</span></a> x ' . (isset($badges[$key]["Anzahl"]) ? $badges[$key]["Anzahl"] + 0 : 0) . '</td>';
echo '<td class="desc">' . html($value["desc"]) . '</td>';
echo '</tr>';
}
示例11: _e
<div id="contrib-users" class="widget">
<h2 class="contributorback"><?php
echo _e("Contributors");
?>
</h2>
<?php
$db = new SQL(0);
$rows = $db->cmdrows(0, 'SELECT T1.id, T1.username ,T1.email_standard as email ,T2.last_writeaction
FROM user_list as T1
LEFT JOIN user_action as T2 ON T1.id=T2.user
WHERE 1 GROUP BY T1.id ORDER BY T2.last_writeaction DESC LIMIT 0,16');
foreach ($rows as $row) {
echo '<a style="text-decoration:none" href="' . UserProfile::ProfilePermaLink($row["id"], $row["username"]) . '"><img class="gravatar" width="48" height="48" src="http://www.gravatar.com/avatar/' . md5(strtolower(trim($row["email"]))) . '?s=48&d=mm" title="' . html($row["username"]) . '" alt="' . _e("{0}'s Gravatar Image", array($row["username"])) . '"></a>';
}
?>
</div>
示例12: html
<?php
$db = new SQL(0);
$sql = 'SELECT SQL_CALC_FOUND_ROWS * FROM user_badges as T1 LEFT JOIN user_list as T2 ON T1.user=T2.id';
$sql .= ' WHERE badge = {0} ';
switch (isset($_GET["sort"]) ? $_GET["sort"] : "karma") {
case "name":
$sql .= ' ORDER BY username ASC';
break;
case "karma":
$sql .= ' ORDER BY Karma DESC';
break;
}
$sql .= ' LIMIT ' . (isset($_GET["page"]) ? $_GET["page"] * 60 : "0") . ',60';
$rows = $db->cmdrows(0, $sql, array($params["badge_id"] + 0));
$AnzahlUsers = $db->countallrows();
PageEngine::html("html_head", array("title" => _h("{n} Benutzer haben dieses Abzeichen", array("n" => $AnzahlUsers))));
PageEngine::html("header");
?>
<div id="Content" class="content-wrapper PageUsers">
<article class="ContentLeft">
<h1>Abzeichen "<?php
echo html(Badges::$badgelist[$params["badge_id"] + 0]["title"]);
?>
"</h1>
<p><span class="awardmedal"><span class="award<?php
echo Badges::$badgelist[$params["badge_id"] + 0]["medal"];
?>
"><?php
echo html(Badges::$badgelist[$params["badge_id"] + 0]["title"]);
示例13: gmdate
<?php
@header("Content-Type: text/css; Charset: UTF-8");
$expires = 3600;
@header("Pragma: public");
@header("Cache-Control: maxage=" . $expires);
@header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');
$a = fcache::read(__FILE__, 3600);
if ($a != null) {
die($a);
}
$db = new SQL(0);
$rows = $db->cmdrows(0, 'SELECT tag,icon_URL FROM tag_details WHERE icon_URL != ""');
$out = "";
foreach ($rows as $row) {
$out .= '.tags a.tag.' . niceClass($row["tag"]) . ' { background: #F3F6F6 url(\'' . $row["icon_URL"] . '\') no-repeat left center; background-size: 16px 16px; padding-left: 18px; }' . PHP_EOL;
}
$out .= '/***cached at ' . date("d.m.Y H:i:s") . ' ***/' . PHP_EOL;
fcache::write(__FILE__, $out);
echo $out;
exit(1);
示例14: _e
<div id="widget-tags" class="widget tags">
<h2 class="contributorback"><?php
echo _e("Tags");
?>
</h2>
<ul class="tags"><?php
$db = new SQL(0);
$rows = $db->cmdrows(0, 'SELECT tag, count(*) as Anzahl FROM question_tags WHERE (tag != "") GROUP BY tag ORDER BY Anzahl DESC LIMIT 0,50');
foreach ($rows as $row) {
echo '<li><a class="tag ' . Tag::niceClass($row["tag"]) . '" href="' . get_path("/tags/" . html($row["tag"]) . "/info") . '">' . html($row["tag"]) . '</a> x <span class="counter">' . $row["Anzahl"] . '</span></li>';
}
?>
</ul>
</div>
示例15: _e
<?php
$db = new SQL(0);
$rows = $db->cmdrows(0, 'SELECT id, title,MATCH (`title`,`question`,`tags`) AGAINST ("{0}") as Score FROM questions WHERE id != {1} AND MATCH (`title`,`question`,`tags`) AGAINST ("{0}") ORDER BY Score DESC LIMIT 0,5', array($params["data"]["title"] . " " . $params["data"]["question"] . " " . $params["data"]["tags"], $params["data"]["id"] + 0));
?>
<div id="widget-similar" class="widget similar questions">
<h2 class=""><?php
echo _e("similar questions");
?>
</h2>
<ul>
<?php
foreach ($rows as $row) {
echo '<li><a class="question" href="' . Question::PermalinkByData($row["id"], $row["title"]) . '">' . html($row["title"]) . '</a> ' . number_format($row["Score"], 1) . '%</li>';
}
?>
</ul>
</div>
<style>
#widget-similar ul { padding:0px; margin:0px; }
#widget-similar li { font-family: 'Yanone Kaffeesatz',Arial,sans-serif; font-size:14px; list-style: none; margin: 4px 0px; padding:0px; color: #707070; }
#widget-similar a { color: #1B79BD; }
#widget-similar a:hover { }
</Style>