This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Add-ons Recent Comments not working !
#1

Hello,

I tried the add-ons Recent Comments on my page :

http://www.colorear2000.com/example.php

But nothing appears !

Is the add-ons compatible with V2.2 ?

Code of my page :

Quote:<?php
session_start();
ob_start();
?>
<html>
<head>
<title>Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="comments/css/stylesheet.css"/>
</head>
<body>


<br/>

<?php
$cmtx_page_id = "1";
$cmtx_reference = "Page One";
$cmtx_path = "comments/";
define('IN_COMMENTICS', 'true'); //no need to edit this line
require $cmtx_path . "includes/commentics.php"; //no need to edit this line
?>

<br><br>

<?php
define('IN_COMMENTICS', '1');
require_once "comments/includes/db/connect.php";


// Start of 'Recent Comments' **********************************************************************************************
echo "<h3>Recent Comments</h3>";

$comments = mysql_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `is_approved` = '1' ORDER BY `dated` DESC LIMIT 5");

while ($comment = mysql_fetch_array($comments)) {

$page_query = mysql_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "pages` WHERE `id` = '" . $comment["page_id"] . "'");
$page = mysql_fetch_assoc($page_query);

echo $comment["name"] . " on <a href='" . $page["url"] . "'>" . $page["reference"] . "</a> at " . date("g:ia (jS-M)", strtotime($comment["dated"]));
echo "<br/>";

}
// End of 'Recent Comments' ************************************************************************************************


echo "<p/>";


// Start of 'Most Commented' ***********************************************************************************************
echo "<h3>Most Commented</h3>";

$comments = mysql_query("SELECT `page_id`, COUNT(`page_id`) AS `total` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `is_approved` = '1' GROUP BY `page_id` ORDER BY `total` DESC LIMIT 5");

while ($comment = mysql_fetch_assoc($comments)) {

$page_query = mysql_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "pages` WHERE `id` = '" . $comment["page_id"] . "'");
$page = mysql_fetch_assoc($page_query);

echo "<a href='" . $page["url"] . "'>" . $page["reference"] . "</a> (" . $comment["total"] . ")";
echo "<br/>";

}
// End of 'Most Commented' *************************************************************************************************


echo "<p/>";


// Start of 'Top Posters' **************************************************************************************************
echo "<h3>Top Posters</h3>";

$names = mysql_query("SELECT `name`, COUNT(`name`) AS `total` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `is_approved` = '1' GROUP BY `name` ORDER BY `total` DESC LIMIT 5");

while ($name = mysql_fetch_assoc($names)) {

echo $name["name"] . " (" . $name["total"] . ")";
echo "<br/>";

}
// End of 'Top Posters' ****************************************************************************************************


echo "<p/>";


// Start of 'Best Rated' **************************************************************************************************
echo "<h3>Best Rated</h3>";

$comments = mysql_query("SELECT `page_id`, AVG(`rating`) AS `average` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `is_approved` = '1' AND `rating` != '0' GROUP BY `page_id` ORDER BY `average` DESC LIMIT 5");

while ($comment = mysql_fetch_assoc($comments)) {

$average = round($comment["average"] / 0.5) * 0.5;

$page_query = mysql_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "pages` WHERE `id` = '" . $comment["page_id"] . "'");
$page = mysql_fetch_assoc($page_query);

echo "<a href='" . $page["url"] . "'>" . $page["reference"] . "</a> (" . $average . ")";
echo "<br/>";

}
// End of 'Best Rated' ****************************************************************************************************
?>



</body>
</html>

Thanks
Eric
Reply
#2

Hi,

Yes it's compatible with v2.2.

Have you got Error Reporting switched on?

http://www.commentics.org/support/knowle...article=15

Have you completed the interview?
Reply
#3

(07-Nov-2012, 02:34 PM)Steven Wrote:  Hi,

Yes it's compatible with v2.2.

Have you got Error Reporting switched on?

http://www.commentics.org/support/knowle...article=15

Yes, I have message :

Quote:Notice: Constant IN_COMMENTICS already defined in /homez.19/colorear/www/example.php on line 27

Recent Comments

Notice: Undefined variable: cmtx_mysql_table_prefix in /homez.19/colorear/www/example.php on line 34

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /homez.19/colorear/www/example.php on line 36


Most Commented

Notice: Undefined variable: cmtx_mysql_table_prefix in /homez.19/colorear/www/example.php on line 54

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /homez.19/colorear/www/example.php on line 56


Top Posters

Notice: Undefined variable: cmtx_mysql_table_prefix in /homez.19/colorear/www/example.php on line 74

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /homez.19/colorear/www/example.php on line 76


Best Rated

Notice: Undefined variable: cmtx_mysql_table_prefix in /homez.19/colorear/www/example.php on line 91

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /homez.19/colorear/www/example.php on line 93
Reply
#4

(07-Nov-2012, 03:57 PM)besric Wrote:  [quote='Steven' pid='3692' dateline='1352298893']
Hi,

Yes it's compatible with v2.2.

Have you got Error Reporting switched on?

http://www.commentics.org/support/knowle...article=15

Yes, I have message :

Quote:Notice: Constant IN_COMMENTICS already defined in /homez.19/colorear/www/example.php on line 27

Recent Comments

Notice: Undefined variable: cmtx_mysql_table_prefix in /homez.19/colorear/www/example.php on line 34

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /homez.19/colorear/www/example.php on line 36


Most Commented

Notice: Undefined variable: cmtx_mysql_table_prefix in /homez.19/colorear/www/example.php on line 54

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /homez.19/colorear/www/example.php on line 56


Top Posters

Notice: Undefined variable: cmtx_mysql_table_prefix in /homez.19/colorear/www/example.php on line 74

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /homez.19/colorear/www/example.php on line 76


Best Rated

Notice: Undefined variable: cmtx_mysql_table_prefix in /homez.19/colorear/www/example.php on line 91

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /homez.19/colorear/www/example.php on line 93

For information

My prefix table is "commentics"
Reply
#5

My problem is solved, I added the prefix "commentics" and now its ok !

Thanks Steven for your wonderful script !
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by Steven
28-Mar-2023, 12:17 PM
Last Post by noblues
26-Sep-2013, 05:44 PM
Last Post by kooler
02-Aug-2013, 05:29 PM
Last Post by Steven
27-Jan-2013, 09:31 PM
Last Post by brande
23-Jan-2013, 07:08 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)