Comments Compare + Count

16 posts by 2 authors in: Forums > CMS Builder
Last Post: July 16, 2010   (RSS)

Ok. The error is gone. I had to at @ before $count, but it doesn't reflect an accurate comment count, and somehow leaves the first article out. If you load this link, http://www.illumemag.com/zine/categoryIndex.php you can see.

Thanks.

Re: [Illume Magazine] Comments Compare + Count

I updated with this and it works well. Thanks for all your help Jason!

<?php
$trans = array("-" => "", " " => "-", ";" => "", "'" => "", ":" => "");
$commentValue = "/zine/articleDetail.php?".strtr($record['title'], $trans)."-".$record['num'];
@$count = mysql_select_count_from("comments","commentValue='$commentValue'");
?><?php echo @$count; ?>

Re: [Illume Magazine] Comments Compare + Count

hmm...still skipping out on url format...misses some article titles..
Thank you Jason. The only thing that remains to be resolved are the single and double quotes in the article title.

Re: [Illume Magazine] Comments Compare + Count

By Jason - July 16, 2010

Hi,

You can try adding the single and double quotes to your array that's used to remove characters from the string.
Something like this:
$trans = array("-" => "", " " => "-", ";" => "", "'" => "-", ":" => "","?"=>"","\'"=>"","\""=>"");

This should strip out single and double quotes completely.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/