當前位置: 首頁>>代碼示例>>PHP>>正文


PHP C::query方法代碼示例

本文整理匯總了PHP中C::query方法的典型用法代碼示例。如果您正苦於以下問題:PHP C::query方法的具體用法?PHP C::query怎麽用?PHP C::query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在C的用法示例。


在下文中一共展示了C::query方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: insertIntoSQL

 public function insertIntoSQL($name, $content)
 {
     global $config;
     $table = C::isLocal() ? $config['message']['local_table'] : $config['message']['table'];
     $query = sprintf("INSERT INTO %s (message_name,message_content)VALUES\n\t\t\t\t\t\t('%s','%s')", $table, $name, $content);
     if (C::query($query, $this->dbc)) {
         return array('isok' => '1', 'info' => '');
     } else {
         return array('isok' => '0', 'info' => $table . '--' . $query . '--' . mysql_error($this->dbc), 'info2' => $this->dbc);
     }
 }
開發者ID:AJLoveChina,項目名稱:MyBlog,代碼行數:11,代碼來源:page.php

示例2: getPageByXueshuId

 public function getPageByXueshuId($id)
 {
     $back = '';
     $query = sprintf("SELECT xueshu_id,huida_id,user_id,kinds,title,content,huida,filename,UNIX_TIMESTAMP(date_entered) AS time\n\t\t\t\tFROM %s WHERE xueshu_id = %d ", $this->table, $id);
     $result = C::query($query, $this->dbc);
     if ($result) {
         if (mysql_num_rows($result) > 0) {
             $rows = mysql_fetch_array($result);
             $back .= $this->wrapXueshu($rows);
             $query = sprintf("SELECT xueshu_id,huida_id,user_id,kinds,title,content,huida,filename,UNIX_TIMESTAMP(date_entered) AS time\n\t\t\t\tFROM %s WHERE huida_id = %d ORDER BY date_entered DESC", $this->table, $id);
             $result = C::query($query, $this->dbc);
             if (mysql_num_rows($result) > 0) {
                 $back .= "<h2>全部回複</h2>";
                 while ($rows2 = mysql_fetch_array($result)) {
                     $back .= $this->wrapXueshu($rows2);
                 }
             } else {
                 $back .= "<h2>還木有人回複這個帖子~</h2>";
             }
             $back .= $this->getXueshuHuidaArea($rows);
         } else {
             $back .= "<h2>Not found!</h2>";
         }
     } else {
         $back .= "<h2>Not found!</h2>";
     }
     return $back;
 }
開發者ID:AJLoveChina,項目名稱:meAjax,代碼行數:28,代碼來源:page.php

示例3: sprintf

    if (isset($_GET['blog_id'])) {
        $blog_id = (int) $_GET['blog_id'];
        $query = sprintf("UPDATE blog SET blog_title = '%s', blog_desc = '%s',types='%s', blog_stamp='%s' \n\t\t\t\t\t\t\tWHERE blog_id = %d ", $title, $desc, $kinds, $stamp, $blog_id);
        if (C::query($query, $dbc)) {
            $query = "SELECT blog_file FROM blog WHERE blog_id = " . $blog_id;
            $result = C::query($query, $dbc);
            $rows = mysql_fetch_array($result);
            if (file_put_contents('../' . $config['blog']['filename'][$side] . $rows['blog_file'] . '.txt', $content)) {
                echo json_encode(array('isok' => '1', 'info' => ''));
            }
        }
    } else {
        $file = sha1(uniqid());
        file_put_contents('../' . $config['blog']['filename'][$side] . $file . '.txt', $content);
        $query = sprintf("INSERT INTO blog (blog_title,blog_desc,blog_file,types,blog_stamp) VALUES (\n\t\t\t\t\t\t\t'%s','%s','%s','%s','%s')", $title, $desc, $file, $kinds, $stamp);
        if (C::query($query, $dbc)) {
            echo json_encode(array('isok' => '1', 'info' => ''));
        } else {
            echo json_encode(array('isok' => '0', 'info' => mysql_error($dbc)));
        }
    }
    exit;
}
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset='UTF-8' />
	<title>Upload</title>
	<style>
		textarea{
開發者ID:AJLoveChina,項目名稱:MyBlog,代碼行數:31,代碼來源:up.content.php


注:本文中的C::query方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。