Getting Number of Files

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
GamerTalk
Forum Newbie
Posts: 4
Joined: Tue Jan 27, 2004 4:51 am

Getting Number of Files

Post 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
User avatar
xisle
Forum Contributor
Posts: 249
Joined: Wed Jun 25, 2003 1:53 pm

Post by xisle »

you are missing this piece of the second query....
mysql_fetch_array($resultID3)
GamerTalk
Forum Newbie
Posts: 4
Joined: Tue Jan 27, 2004 4:51 am

Post by GamerTalk »

Where do I put it? I don't think it solved anything...
User avatar
phpcoder
Forum Contributor
Posts: 158
Joined: Sat Nov 02, 2002 1:18 pm
Location: Manchester, UK

Post 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
GamerTalk
Forum Newbie
Posts: 4
Joined: Tue Jan 27, 2004 4:51 am

Post by GamerTalk »

Sorry for being a pain, but how would I go about executing the query's seperately?
GamerTalk
Forum Newbie
Posts: 4
Joined: Tue Jan 27, 2004 4:51 am

Post by GamerTalk »

I'm sorry if this angers anyone, but I'm bumping this so more people can see it.
User avatar
phpcoder
Forum Contributor
Posts: 158
Joined: Sat Nov 02, 2002 1:18 pm
Location: Manchester, UK

Post 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 .
Post Reply