本文整理汇总了PHP中Sql::excute_query方法的典型用法代码示例。如果您正苦于以下问题:PHP Sql::excute_query方法的具体用法?PHP Sql::excute_query怎么用?PHP Sql::excute_query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sql
的用法示例。
在下文中一共展示了Sql::excute_query方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
public function search()
{
$response = "";
$sqlhandler = new Sql();
if ($this->client) {
$sql = "SELECT * FROM `choice` WHERE content LIKE '%{$this->content}%' LIMIT 0, 1 ";
} else {
$sql = "SELECT * FROM `choice` WHERE content LIKE '%{$this->content}%'";
}
if ($result = $sqlhandler->excute_query($sql)) {
if ($result->num_rows == 0) {
return $this->send_ms("暂时还没有队友碰到这题。");
}
while ($row = $result->fetch_assoc()) {
$key = htmlspecialchars(strtoupper($row['c_key']));
$time = date('g:i A d / M / Y D', $row['c_time']);
$content = htmlspecialchars(stripcslashes($row['content']));
$user = htmlspecialchars(stripcslashes($row['c_user']));
if ($this->client) {
$response .= $content . "|" . $key . "|" . $user;
} else {
$response .= "<p><strong>题目:</strong><span><pre>{$content}</pre></span></p><p><strong>答案:</strong><span class=\"answer\">{$key}</span></p><p class=\"post_info\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span> {$user} <span class=\"glyphicon glyphicon-time\" aria-hidden=\"true\"></span> {$time}</p>";
}
//$response .= "{\"content\": \"{$content}\", \"key\": \"{$key}\", \"user\": \"{$user}\", \"time\": \"{$time}\"},";
}
//$response = rtrim($response, ',') . "]";
//<p><strong>题目:</strong><span><pre>{$content}</pre></span></p><p><strong>答案:</strong><span class=\"answer\">{$key}</span></p><p class=\"post_info\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span> {$user} <span class=\"glyphicon glyphicon-time\" aria-hidden=\"true\"></span> {$time}</p>";
}
return $this->send_ms($response);
}
示例2: Sql
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/page.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/class.php";
show_header("提交测试");
$response = " ";
$sqlhandler = new Sql();
$sql = "SELECT * FROM choice WHERE 1";
if ($result = $sqlhandler->excute_query($sql)) {
$p_total = $result->num_rows;
if ($p_total == 0) {
$response = "暂时还没有队友碰到这题。";
}
while ($row = $result->fetch_assoc()) {
$key = htmlspecialchars(strtoupper($row['c_key']));
$time = date('g:i A d / M / Y D', $row['c_time']);
$content = htmlspecialchars(stripcslashes($row['content']));
$response .= "<div class=\"search_result\"><p><strong>题目{$row['id']}:</strong><span><pre>{$content}</pre></span></p><p><strong>答案:</strong><span class=\"answer\">{$key}</span></p><p class=\"post_info\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span> {$row['c_user']} <span class=\"glyphicon glyphicon-time\" aria-hidden=\"true\"></span> {$time}</p></div>";
}
}
?>
<div class="cover result">
<p>已提交<strong> <?php
echo $p_total;
?>
</strong>题,题目编号为提交次序。</p>
<?php
echo $response;
?>
</div>