View Full Version : Category and Link Counts Incorrect
iamck
08-13-2006, 11:04 PM
Hi,
I have a problem where the number of links in each category displayed is incorrect.
Any help would be greatly appreciated.
1. Please always post a link to the page in question
2. Which version of the script you are using?
3. Is it fresh install or upgrade from other version or script?
iamck
08-13-2006, 11:53 PM
Apologies...
The website is www.puntersindex.com. All categories and links are affected.
I am using the latest version of the PAID FOR software including the update.
iamck
08-14-2006, 01:14 AM
I've also found another error....
The move link function on my admin control panel does not work and returns a fatal error.
You will have to wait for Vincent or Dave Baker to check it for you - looks like this issue is database or server configuration related...
Also you need to enable news functionality from the admin panel - it shows error when you click on "news" link
Vincent Wright
08-14-2006, 04:48 AM
As for statistics: where exactly is it wrong?
As for move function: I need admin credentials to check it.
Vince, check this for example: http://www.puntersindex.com/football/england/championship/
Just try to go deep in any of the main categories and eventually you get this result...
Vincent Wright
08-14-2006, 05:00 AM
Yes, I see now.
Well, there are two possible (I'm aware of) reasons: either ROOT category or flat_structure table got corrupted somehow.
sdawkins
08-14-2006, 12:20 PM
When my count was wrong I did this..
http://www.esyndicat.com/forum/showthread.php?t=5555&highlight=link+count
Vincent Wright
08-14-2006, 12:23 PM
I hope this will help.
iamck
08-14-2006, 03:25 PM
When my count was wrong I did this..
http://www.esyndicat.com/forum/showthread.php?t=5555&highlight=link+count
Thanks for the response sdawkins, unfortunately when I click your link I'm told I don't have sufficient priveleges to access the thread.
sdawkins
08-14-2006, 03:33 PM
Ok here:
Create a php file titled convert_flat.php and add it to your directory and run it.
<?php
require_once('includes/config.inc.php');
require_once('classes/DirDb.php');
$db = new Database();
$db->mDbhost = $gDirConfig['dbhost'];
$db->mDbname = $gDirConfig['dbname'];
$db->mDbuser = $gDirConfig['dbuser'];
$db->mDbpwd = $gDirConfig['dbpwd'];
$db->connect();
// Get categories
$sql = "SELECT `id`,`id_parent` FROM `{$gDirConfig['prefix']}categories` WHERE `id_parent` > -1";
$cats =& $db->getAll($sql);
if ($cats)
{
foreach ($cats as $key => $value)
{
$sql = "INSERT INTO `{$gDirConfig['prefix']}flat_structure` (`id_parent`,`id_category`)";
$sql .= "VALUES ({$value['id']}, {$value['id']})";
$db->query($sql);
add_flat($value['id'], $value['id_parent']);
}
}
function add_flat($id, $id_parent)
{
global $db;
global $gDirConfig;
// Insert record into "flat" table
$sql = "INSERT INTO `{$gDirConfig['prefix']}flat_structure` (`id_parent`,`id_category`)";
$sql .= "VALUES ({$id_parent},{$id})";
$db->query($sql);
// Check if parent > 0 and call itself recursively
if ($id_parent > 0)
{
// Get parent's parent
$sql = "SELECT `id_parent` FROM `dir_categories` WHERE `id` = {$id_parent}";
$id_parent2 = $db->getOne($sql);
add_flat($id, $id_parent2);
}
}
?>
iamck
08-14-2006, 04:08 PM
Thanks for taking the time to post that sdawkins. Unfortunately it didn't work.
Is there a member of the admin team willing to look at this if I send them the access details?
sdawkins
08-14-2006, 05:59 PM
Maybe it needs to be run in root?
iamck
08-14-2006, 06:07 PM
Yep, ran it in root SD.
Vincent Wright
08-15-2006, 04:38 AM
So, did that fix link/category counts?
iamck
08-15-2006, 09:43 AM
No Vincent the counts are still incorrect in addition I can't move links to different categories (time out error). Any ideas?
Vincent Wright
08-15-2006, 10:54 AM
Well, if it's appropriate for you I can try fixing it myself, but I need site info:
Directory url
Directory admin credentials
FTP credentials
CPanel credentials
If you email it to me I will be able to take a look.
Email: vwright at esyndicat dot com
iamck
08-15-2006, 11:17 AM
I've emailed you the details Vince. Thanks for the help.
iamck
08-17-2006, 10:47 AM
Everything is working fine now thanks to Vincent who sorted all of my problems.
Excellent stuff Vincent
Vincent Wright
08-17-2006, 10:49 AM
You are welcome.
Cougar
08-31-2006, 08:31 PM
Hey Vincent,
I just moved several of my categories around and ran into the same issue with top category counts not correct. I tried running the 'convert_flat' code provided by sdawkins but get the sql error below:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '272)' at line 1
Any ideas? You should have my ftp info already if you need to access the site (QueerSeek)
Cheers!
Mike
Vincent Wright
09-06-2006, 11:44 AM
Ok, Cougar,
I will try to find your credentials and fix the problem.
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.