本文整理汇总了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);
}
}
示例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;
}
示例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{