Posts: 8
Threads: 2
Joined: Feb 2014
I've upgraded to V2.5 (fresh install, not update) and the former code I used to show the comment count doesn't seem to work (and actually crashes the whole script). I get "access denied" message instead of a count and the comments form doesn't even show up (as the first code of comment count is used before the form).
<?php
$id = "34"; //The ID of the page. You can get this from Manage -> Pages.
define('IN_COMMENTICS', '1');
require_once ($_SERVER['DOCUMENT_ROOT'].'comments/includes/db/connect.php');
$query = mysql_query("SELECT * FROM `".$cmtx_mysql_table_prefix."commentics` WHERE is_approved = '1' AND page_id = '$id'");
$total = mysql_num_rows($query);
echo $total;
?>
Tried to delete the define line, but no difference.
Posts: 2,904
Threads: 59
Joined: Jun 2010
Have
you completed
the interview?
Posts: 8
Threads: 2
Joined: Feb 2014
Damn... stil can't get it work. Reinstalled it and used comments database, then changed the code (actually using a new test page to make sure nothing is interfering). All I use on a new page is:
<?php
session_start();
?>
<?php
$id = "34"; //The ID of the page. You can get this from Manage -> Pages.
$cmtx_path = '1';
require_once ($_SERVER['DOCUMENT_ROOT'].'comments/includes/db/connect.php');
$query = mysqli_query($cmtx_link, "SELECT * FROM `".$cmtx_mysql_table_prefix."comments` WHERE is_approved = '1' AND page_id = '$id'");
$total = mysqli_num_rows($query);
echo $total;
?>
After this is executed I get this error:
Sorry, there is a database problem.</p><p>Please check back shortly. Thanks.
SCREAM: Error suppression ignored for
Warning: mysqli_query() expects parameter 1 to be mysqli, null given in C:\wamp\www\ssi\related\category\related.html on line 27 (the included page where the above code is used for a count view).
and nothing else is loaded afterwards (the actual commentics form).
Posts: 2,904
Threads: 59
Joined: Jun 2010
Have
you completed
the interview?
Posts: 2,904
Threads: 59
Joined: Jun 2010
Have
you completed
the interview?
Posts: 8
Threads: 2
Joined: Feb 2014
Great Steven, everything works as supposed, EXCEPT - when the count is pulled, it seems that it's shown by the page id (in a comments table), but NOT by the new $cmtx_identifier variable.
Here's an example from myPHPadmin, database "comments", table "pages":
I have 4 test pages with comments now, each has that auto-incremental id assigned. IF I write a number from a 1-4 range in that line: "$id = "4"; //The ID of the page. You can get this from Manage -> Pages." , it DOES show the exact number of comments (all good), BUT not of the actual $cmtx_page_id = '48'; which now is replaced with $cmtx_identifier = '48' in the form integration code (and it's NOT the "page_id" anymore from what I understand), it shows the count based that auto-incremental id variable instead. My guess would be that cmtx_identifier change is somehow related with this new issue.
Posts: 2,904
Threads: 59
Joined: Jun 2010
Have
you completed
the interview?
Posts: 8
Threads: 2
Joined: Feb 2014
Seems it's working as supposed now, thank you very much! I'll make sure to support your project as it's a great piece of software and you're a great help Steven.