Page 1 of 1

Getting Number of Files

Posted: Tue Jan 27, 2004 4:51 am
by GamerTalk
Hello everyone, I welcome any help.

My problem lies in the fact that I can only get the amount of files from the regular categories in my db, and not the subs. http://www.gamer-talk.net/downloads.html

The subs have the column parentid.

Code: Select all

<?


$resultID99 = mysql_query("SELECT * FROM `down_cats` ORDER BY `catname` ASC", $linkID);
while ($row99 = mysql_fetch_array($resultID99))

&#123;

$cid="$row99&#1111;catid]";
$catname="$row99&#1111;catname]";
$counter="$row99&#1111;counter]";
$description="$row99&#1111;description]";

$parid="$row99&#1111;parentid]";

$resultID3 = mysql_query("SELECT * FROM `down_files` WHERE catid = '$parid' OR catid = '$cid';", $linkID);
$numfiles = mysql_num_rows($resultID3);

if($parid == "") &#123;
?>
<tr><td>
<b><a href="downcat<? echo "$cid"; ?>.html"><? echo "$catname"; ?></a></b><br>
<? echo "$description"; ?></td><td valign="middle"><? echo "$numfiles"; ?></td></tr>


<? &#125; ?>

<? &#125; ?>
Thanks,
Adam

Posted: Tue Jan 27, 2004 10:40 am
by xisle
you are missing this piece of the second query....
mysql_fetch_array($resultID3)

Posted: Tue Jan 27, 2004 1:50 pm
by GamerTalk
Where do I put it? I don't think it solved anything...

Posted: Tue Jan 27, 2004 2:09 pm
by phpcoder

Code: Select all

<?php
$numfiles = mysql_num_rows($resultID3); 


?>
if $numfiles equal to zero then u r not getting data from db . may b some prob in ur query try to execuet query seperately and check either u got any data or not

Posted: Tue Jan 27, 2004 2:15 pm
by GamerTalk
Sorry for being a pain, but how would I go about executing the query's seperately?

Posted: Tue Jan 27, 2004 9:49 pm
by GamerTalk
I'm sorry if this angers anyone, but I'm bumping this so more people can see it.

Posted: Wed Jan 28, 2004 12:17 pm
by phpcoder
if u have phpMyAdmin use it or apply query on mysql directly .Thing is u just want to confirm that either u r getting data from table of not .