Follow us on Facebook and Twitter!

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, 03: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, 04: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
Sad Recent Comments..again noblues 2 1,930 26-Sep-2013, 06:44 PM
Last Post: noblues
  Recent Comments resp. Pages kooler 2 2,021 02-Aug-2013, 06:29 PM
Last Post: kooler
  Recent Comments CommiC 6 4,674 23-Jun-2013, 12:09 AM
Last Post: CommiC
  Improved Manage Comments Addon MuffinMan 5 3,378 21-Apr-2013, 09:30 PM
Last Post: MuffinMan
  using permalinks on recent comments module otuzel 2 2,313 12-Mar-2013, 11:11 PM
Last Post: otuzel
  Recent Comments Add On Help brande 3 2,990 27-Jan-2013, 10:31 PM
Last Post: Steven
  recent comment add on style brande 0 1,556 23-Jan-2013, 08:08 PM
Last Post: brande
  Auto populate your comments table corculator 0 1,873 25-Feb-2012, 01:25 PM
Last Post: corculator
  Cannot get recent comments add on to work stevylake 1 2,184 04-Sep-2011, 01:25 PM
Last Post: Steven

Forum Jump:


Users browsing this thread: 1 Guest(s)