当前位置: 首页>>代码示例>>PHP>>正文


PHP Sql::excute_query方法代码示例

本文整理汇总了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} &nbsp;&nbsp;&nbsp;&nbsp; <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} &nbsp;&nbsp;&nbsp;&nbsp; <span class=\"glyphicon glyphicon-time\" aria-hidden=\"true\"></span> {$time}</p>";
     }
     return $this->send_ms($response);
 }
开发者ID:Yang-ZL,项目名称:Cooperative-problem-solving-system,代码行数:30,代码来源:class.php

示例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']} &nbsp;&nbsp;&nbsp;&nbsp; <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>
开发者ID:Yang-ZL,项目名称:Cooperative-problem-solving-system,代码行数:31,代码来源:show_all.php


注:本文中的Sql::excute_query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。