hello,
im currently running pafiledb on my test machine and it
s really a awsome file database script.. but as soon as i install the 4 level sub mod (its here: [url]http://forums.pamods.net/index.php?showtopic=8[/url] and [url]http://forums.pamods.net/index.php?showtopic=121[/url] for the correct count but with HUGE query counts :( ) i
m stuck with the problem that i get a huge query count where the subcatogory`s are... this is what i currently have: MySQL Queries Used : 207 Queries
Thats just extreme and i would like to bring it down to a normal level.. i only don
t know why and its not my intention to rebuild the entire database mod since that
s to manny work.
But i did find out whitch part of the code is causing the high query count.. it`s this "babe"
function get_file_count($db, $pafiledb_sql, $cat_id)
{
$filesincat = 0;
if (!$cat_id == "")
{
$result = $pafiledb_sql->query($db, "SELECT * FROM $db[prefix]_cat WHERE cat_parent = $cat_id ORDER BY cat_order", 0);
$filesincat += $pafiledb_sql->query($db, "SELECT * FROM $db[prefix]_files WHERE file_catid = $cat_id", 2);
while(
$i = mysql_fetch_row($result)
)
{
$filesincat += get_file_count($db, $pafiledb_sql, $i[0]);
}
}
return $filesincat;
}
"This is an example where the function is being used.. where you see $filesincat is the place where it`s actually being executed.
while ($category = mysql_fetch_object($result)) {
if ($category->cat_parent == 0)
{
$filesincat = get_file_count($db, $pafiledb_sql, $category->cat_id);
//Smalltext on and off function
if ($configexed[1] == 0)
{
if ($zz==0)
{
echo "<tr><td width=\"80%\" class=\"datacell\"><a href=\"pafiledb.php?action=category&id=$category->cat_id\">$category->cat_name</a></td><td width=\"10%\" class=\"datacell\"><center>$filesincat</center></td></tr>";
$zz = 1;
}
else
{
echo "<tr><td width=\"80%\" class=\"datacell2\"><a href=\"pafiledb.php?action=category&id=$category->cat_id\">$category->cat_name</a></td><td width=\"10%\" class=\"datacell2\"><center>$filesincat</center></td></tr>";
$zz =0;
}
}
else
{
if ($zz==0)
{
echo "<tr><td width=\"80%\" class=\"datacell\"><a href=\"pafiledb.php?action=category&id=$category->cat_id\">$category->cat_name</a><br><a class=\"smalltext\">» $category->cat_desc «</a></td><td width=\"10%\" class=\"datacell\"><center>$filesincat</center></td></tr>";
$zz = 1;
}
else
{
echo "<tr><td width=\"80%\" class=\"datacell2\"><a href=\"pafiledb.php?action=category&id=$category->cat_id\">$category->cat_name</a><br><a class=\"smalltext\">» $category->cat_desc «</a></td><td width=\"10%\" class=\"datacell2\"><center>$filesincat</center></td></tr>";
$zz = 0;
}
}
}
}
dont look at the $zz = 0 en $zz = 1.. i
m changing that for a way more efficient way of doing the 2 colored listing
i hope you guys have all the info you need to give me hints/example how to fix this problem. if not than ask as much as you want