本文整理汇总了PHP中cmtx_db_fetch_assoc函数的典型用法代码示例。如果您正苦于以下问题:PHP cmtx_db_fetch_assoc函数的具体用法?PHP cmtx_db_fetch_assoc怎么用?PHP cmtx_db_fetch_assoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cmtx_db_fetch_assoc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cmtx_delete_replies
function cmtx_delete_replies($id)
{
//delete replies of comment
global $cmtx_mysql_table_prefix;
$query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `reply_to` = '{$id}'");
while ($comments = cmtx_db_fetch_assoc($query)) {
$id = $comments["id"];
cmtx_db_query("DELETE FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `id` = '{$id}'");
cmtx_db_query("DELETE FROM `" . $cmtx_mysql_table_prefix . "voters` WHERE `comment_id` = '{$id}'");
cmtx_db_query("DELETE FROM `" . $cmtx_mysql_table_prefix . "reporters` WHERE `comment_id` = '{$id}'");
cmtx_delete_replies($id);
}
}
示例2: cmtx_db_query
echo CMTX_RATE_NO_PAGE;
return;
}
//check if user has already rated as a poster
$query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `page_id` = '{$id}' AND `ip_address` = '{$ip_address}' AND `rating` != '0'");
$count = cmtx_db_num_rows($query);
if ($count > 0) {
echo CMTX_RATE_ALREADY_RATED;
return;
}
//check if user has already rated as a guest
$query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "ratings` WHERE `page_id` = '{$id}' and `ip_address` = '{$ip_address}'");
$count = cmtx_db_num_rows($query);
if ($count > 0) {
echo CMTX_RATE_ALREADY_RATED;
return;
}
//check if user is banned
$query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "bans` WHERE `ip_address` = '{$ip_address}'");
$count = cmtx_db_num_rows($query);
if ($count > 0) {
echo CMTX_RATE_BANNED;
return;
}
cmtx_db_query("INSERT INTO `" . $cmtx_mysql_table_prefix . "ratings` (`page_id`, `rating`, `ip_address`, `dated`) values ('{$id}', '{$rating}', '{$ip_address}', NOW())");
$result = cmtx_db_query("SELECT AVG(`rating`) \r\n\tFROM ( \r\n\tSELECT `rating` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `is_approved` = '1' AND `rating` != '0' AND `page_id` = '{$id}' \r\n\tUNION ALL \r\n\tSELECT `rating` FROM `" . $cmtx_mysql_table_prefix . "ratings` WHERE `page_id` = '{$id}' \r\n\t) \r\n\tAS `average`\r\n\t");
$average = cmtx_db_fetch_assoc($result);
$average = $average["AVG(`rating`)"];
$average = round($average, 0);
echo $average;
}
示例3: cmtx_db_query
}
if (isset($_POST['to_reply'])) {
cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "subscribers` SET `to_reply` = '1' WHERE `token` = '{$token}'");
} else {
cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "subscribers` SET `to_reply` = '0' WHERE `token` = '{$token}'");
}
?>
<div class="success"><?php
echo CMTX_SUB_MSG_SETTINGS_SAVED;
?>
</div><?php
?>
<div style="clear:left"></div><?php
}
$subscriber = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "subscribers` WHERE `token` = '{$token}'");
$subscriber = cmtx_db_fetch_assoc($subscriber);
?>
<div class="subscription_info_block">
<label class="subscription_info_label"><?php
echo CMTX_SUB_NAME;
?>
</label> <?php
echo $subscriber['name'];
?>
<br/>
<label class="subscription_info_label"><?php
echo CMTX_SUB_EMAIL;
?>
</label> <?php
echo $subscriber['email'];
示例4: cmtx_get_question
function cmtx_get_question()
{
//get captcha question and answer
global $cmtx_mysql_table_prefix;
//globalise variables
$query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "questions` ORDER BY Rand() LIMIT 1");
$result = cmtx_db_fetch_assoc($query);
$question = array($result['question'], $result['answer']);
return $question;
}
示例5: cmtx_db_query
echo CMTX_MSG_SAVED;
?>
</div>
<div style="clear: left;"></div>
<?php
}
?>
<?php
}
}
?>
<?php
$administrator = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "admins` WHERE `id` = '{$admin_id}'");
$administrator = cmtx_db_fetch_assoc($administrator);
$username = $administrator["username"];
$email = $administrator["email"];
$receive_email_new_ban = $administrator["receive_email_new_ban"];
$receive_email_new_comment_approve = $administrator["receive_email_new_comment_approve"];
$receive_email_new_comment_okay = $administrator["receive_email_new_comment_okay"];
$receive_email_new_flag = $administrator["receive_email_new_flag"];
?>
<p />
<?php
echo CMTX_DESC_SETTINGS_ADMIN;
?>
<p />
示例6: cmtx_db_query
</th>
<th><?php
echo CMTX_TABLE_DATE_TIME;
?>
</th>
<th><?php
echo CMTX_TABLE_ACTION;
?>
</th>
</tr>
</thead>
<tbody>
<?php
$administrators = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "admins` ORDER BY `id` ASC");
while ($administrator = cmtx_db_fetch_assoc($administrators)) {
?>
<tr>
<td><input type="checkbox" name="bulk[]" value="<?php
echo $administrator["id"];
?>
" onclick="bulk_check();"/></td>
<td><?php
echo $administrator["username"];
?>
</td>
<td><?php
echo $administrator["email"];
?>
</td>
<td><?php
示例7: cmtx_db_query
</th>
<th><?php
echo CMTX_TABLE_ANSWER;
?>
</th>
<th><?php
echo CMTX_TABLE_ACTION;
?>
</th>
</tr>
</thead>
<tbody>
<?php
$questions = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "questions`");
while ($question = cmtx_db_fetch_assoc($questions)) {
?>
<tr>
<td><input type="checkbox" name="bulk[]" value="<?php
echo $question["id"];
?>
" onclick="bulk_check();"/></td>
<td><?php
echo $question["question"];
?>
</td>
<td><?php
echo $question["answer"];
?>
</td>
<td>
示例8: cmtx_sanitize
?>
<div class="success"><?php
echo CMTX_MSG_BAN_UPDATED;
?>
</div>
<div style="clear: left;"></div>
<?php
}
}
?>
<?php
$id = $_GET['id'];
$id_san = cmtx_sanitize($id);
$ban_query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "bans` WHERE `id` = '{$id_san}'");
$ban_result = cmtx_db_fetch_assoc($ban_query);
$ip_address = $ban_result["ip_address"];
$reason = $ban_result["reason"];
$time = cmtx_format_date(date(CMTX_TIME_FORMAT, strtotime($ban_result["dated"])));
$date = cmtx_format_date(date(CMTX_DATE_FORMAT, strtotime($ban_result["dated"])));
?>
<p />
<form name="edit_ban" id="edit_ban" action="index.php?page=edit_ban&id=<?php
echo $id;
?>
" method="post">
<label class='edit_ban'><?php
echo CMTX_FIELD_LABEL_IP_ADDRESS;
?>
示例9: cmtx_db_query
</th>
<th><?php
echo CMTX_TABLE_DATE_TIME;
?>
</th>
<th><?php
echo CMTX_TABLE_ACTION;
?>
</th>
</tr>
</thead>
<tbody>
<?php
$bans = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "bans` WHERE `unban` = '0' ORDER BY `dated` DESC");
while ($ban = cmtx_db_fetch_assoc($bans)) {
?>
<tr>
<td><input type="checkbox" name="bulk[]" value="<?php
echo $ban["id"];
?>
" onclick="bulk_check();"/></td>
<td><?php
echo $ban["ip_address"];
?>
</td>
<td><?php
echo $ban["reason"];
?>
</td>
<td><span style="display:none;"><?php
示例10: cmtx_commentics_url
if (cmtx_setting('show_social_linkedin')) {
echo '<a href="http://www.linkedin.com/shareArticle?mini=true&url=' . $cmtx_social_url . '&title=' . $cmtx_social_title . '" rel="nofollow"' . $cmtx_social_attribute . '><img src="' . cmtx_commentics_url() . 'images/social/linkedin.png" class="cmtx_social_image" title="LinkedIn" alt="LinkedIn"/></a>';
}
echo '</div>';
}
echo '</div>';
echo '<div style="clear: both;"></div>';
/* *** Comments *** */
echo '<div class="cmtx_height_above_comment_boxes"></div>';
$cmtx_sort = cmtx_get_sort_by();
$cmtx_comments_query = cmtx_db_query("SELECT `id` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `reply_to` = '0' AND `is_approved` = '1' AND `page_id` = '{$cmtx_page_id}' ORDER BY {$cmtx_sort};");
//get comments from database
$cmtx_loop_counter = 0;
$cmtx_comment_counter = 0;
$cmtx_exit_loop = false;
while ($cmtx_comments = cmtx_db_fetch_assoc($cmtx_comments_query)) {
//while there are comments
cmtx_get_comment_and_replies($cmtx_comments['id']);
if ($cmtx_exit_loop) {
break;
}
}
echo '<div class="cmtx_height_below_comment_boxes"></div>';
/* *** RSS *** */
echo '<div class="cmtx_rss_block">';
if (cmtx_setting('show_rss')) {
?>
<a href="<?php
echo cmtx_commentics_url() . 'rss.php?id=' . $cmtx_page_id;
?>
" rel="nofollow"><img src="<?php
示例11: cmtx_check_csrf_form_key
<hr class="title"/>
<?php
if (isset($_POST['submit']) && cmtx_setting('is_demo')) {
?>
<div class="warning"><?php
echo CMTX_MSG_DEMO;
?>
</div>
<div style="clear: left;"></div>
<?php
} else {
if (isset($_POST['submit'])) {
cmtx_check_csrf_form_key();
$all_tables = cmtx_db_query("SHOW TABLES");
while ($table = cmtx_db_fetch_assoc($all_tables)) {
foreach ($table as $db => $table_name) {
cmtx_db_query("OPTIMIZE TABLE " . $table_name);
}
}
?>
<div class="success"><?php
echo CMTX_MSG_OPTIMIZED;
?>
</div>
<div style="clear: left;"></div>
<?php
}
}
?>
示例12: cmtx_db_query
if ($type == 'like' && cmtx_setting('show_like')) {
cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "comments` SET `likes` = `likes` + 1 WHERE `id` = '{$id}'");
cmtx_db_query("INSERT INTO `" . $cmtx_mysql_table_prefix . "voters` (`comment_id`, `ip_address`, `dated`) values ('{$id}', '{$ip_address}', NOW())");
} else {
if ($type == 'dislike' && cmtx_setting('show_dislike')) {
cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "comments` SET `dislikes` = `dislikes` + 1 WHERE `id` = '{$id}'");
cmtx_db_query("INSERT INTO `" . $cmtx_mysql_table_prefix . "voters` (`comment_id`, `ip_address`, `dated`) values ('{$id}', '{$ip_address}', NOW())");
}
}
if ($type == 'like') {
$result = cmtx_db_query("SELECT `likes` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `id` = '{$id}'");
if (cmtx_db_num_rows($result)) {
$row = cmtx_db_fetch_assoc($result);
$likes = $row['likes'];
} else {
$likes = 0;
}
echo '<img src="' . cmtx_commentics_url() . 'images/buttons/like.png" alt="Like" title="' . CMTX_TITLE_LIKE . '"/><span id="cmtx_flash_like_' . $id . '">' . $likes . '</span>';
} else {
if ($type == 'dislike') {
$result = cmtx_db_query("SELECT `dislikes` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `id` = '{$id}'");
if (cmtx_db_num_rows($result)) {
$row = cmtx_db_fetch_assoc($result);
$dislikes = $row['dislikes'];
} else {
$dislikes = 0;
}
echo '<img src="' . cmtx_commentics_url() . 'images/buttons/dislike.png" alt="Dislike" title="' . CMTX_TITLE_DISLIKE . '"/><span id="cmtx_flash_dislike_' . $id . '">' . $dislikes . '</span>';
}
}
}
示例13: cmtx_sanitize
?>
<div class="success"><?php
echo CMTX_MSG_QUESTION_UPDATED;
?>
</div>
<div style="clear: left;"></div>
<?php
}
}
?>
<?php
$id = $_GET['id'];
$id_san = cmtx_sanitize($id);
$question_query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "questions` WHERE `id` = '{$id_san}'");
$question_result = cmtx_db_fetch_assoc($question_query);
$question = $question_result["question"];
$answer = $question_result["answer"];
?>
<p />
<form name="edit_question" id="edit_question" action="index.php?page=edit_question&id=<?php
echo $id;
?>
" method="post">
<label class='edit_question'><?php
echo CMTX_FIELD_LABEL_QUESTION;
?>
</label> <input type="text" required name="question" size="50" value="<?php
echo $question;
示例14: cmtx_url_encode
}
echo '
<generator>Commentics</generator>';
if (cmtx_setting('rss_image_enabled')) {
echo '
<image>
<url>' . cmtx_url_encode(cmtx_setting('rss_image_url')) . '</url>
<title>' . cmtx_encode(cmtx_setting('rss_title')) . '</title>
<link>' . cmtx_url_encode(cmtx_setting('rss_link')) . '</link>
<width>' . cmtx_setting('rss_image_width') . '</width>
<height>' . cmtx_setting('rss_image_height') . '</height>
</image>';
}
while ($comments = cmtx_db_fetch_assoc($result)) {
$pages_query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "pages` WHERE `id` = '" . $comments["page_id"] . "'");
$pages = cmtx_db_fetch_assoc($pages_query);
$title = sprintf(CMTX_RSS_POSTER, $comments["name"]);
$link = cmtx_get_permalink($comments["id"], $pages["url"]);
$comment = $comments["comment"];
$dated = date("r", strtotime($comments["dated"]));
$guid = $comments["id"];
echo '
<item>
<title>' . $title . '</title>
<link>' . $link . '</link>
<description><![CDATA[' . $comment . ']]></description>
<pubDate>' . $dated . '</pubDate>
<guid isPermaLink="false">' . $guid . '</guid>
</item>';
}
echo '
示例15: cmtx_db_query
cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "admins` SET `detect_method` = '{$detect_method_san}' WHERE `id` = '{$admin_id}'");
cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "admins` SET `ip_address` = '{$ip_address_san}' WHERE `id` = '{$admin_id}'");
?>
<div class="success"><?php
echo CMTX_MSG_SAVED;
?>
</div>
<div style="clear: left;"></div>
<?php
}
}
?>
<?php
$detection = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "admins` WHERE `id` = '{$admin_id}'");
$detection = cmtx_db_fetch_assoc($detection);
$detect_admin = $detection["detect_admin"];
$detect_method = $detection["detect_method"];
$ip_address = $detection["ip_address"];
$cookie_key = $detection["cookie_key"];
?>
<p />
<?php
echo CMTX_DESC_SETTINGS_ADMIN_DETECTION;
?>
<p />
<form name="settings_admin_detection" id="settings_admin_detection" action="index.php?page=settings_admin_detection" method="post">