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
GamerTalk
Forum Newbie
Posts: 4 Joined: Tue Jan 27, 2004 4:51 am
Post
by GamerTalk » Tue Jan 27, 2004 4:51 am
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))
{
$cid="$row99їcatid]";
$catname="$row99їcatname]";
$counter="$row99їcounter]";
$description="$row99їdescription]";
$parid="$row99їparentid]";
$resultID3 = mysql_query("SELECT * FROM `down_files` WHERE catid = '$parid' OR catid = '$cid';", $linkID);
$numfiles = mysql_num_rows($resultID3);
if($parid == "") {
?>
<tr><td>
<b><a href="downcat<? echo "$cid"; ?>.html"><? echo "$catname"; ?></a></b><br>
<? echo "$description"; ?></td><td valign="middle"><? echo "$numfiles"; ?></td></tr>
<? } ?>
<? } ?>
Thanks,
Adam
xisle
Forum Contributor
Posts: 249 Joined: Wed Jun 25, 2003 1:53 pm
Post
by xisle » Tue Jan 27, 2004 10:40 am
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 » Tue Jan 27, 2004 1:50 pm
Where do I put it? I don't think it solved anything...
phpcoder
Forum Contributor
Posts: 158 Joined: Sat Nov 02, 2002 1:18 pm
Location: Manchester, UK
Post
by phpcoder » Tue Jan 27, 2004 2:09 pm
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 » Tue Jan 27, 2004 2:15 pm
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 » Tue Jan 27, 2004 9:49 pm
I'm sorry if this angers anyone, but I'm bumping this so more people can see it.
phpcoder
Forum Contributor
Posts: 158 Joined: Sat Nov 02, 2002 1:18 pm
Location: Manchester, UK
Post
by phpcoder » Wed Jan 28, 2004 12:17 pm
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 .