reefland
11-09-2003, 04:56 AM
Ok, I am not completely literate when it comes to PHP but...
What I am trying to do is modify a free link system. I have everything working but am trying to add a couple of queries to pull some more info; mainly right now the total number of links per category.
First there is a link table and a category table and I am guessing that I need to work something out together. Both tables have a cat ID in them and I need to get them working together to pull the results but don't know how.
If I do this, I get the total number of categories:
$countcats="SELECT COUNT(id) FROM categories WHERE visible='1'";
$countcatsresult=mysql_query($countcats);
$countcatsrow=mysql_fetch_row($countcatsresult);
If I do this I can get the total number of links:
$countquery="SELECT COUNT(id) FROM links WHERE visible='1'";
$countresult=mysql_query($countquery);
$countrow=mysql_fetch_row($countresult);
Now I need to take each of the cateogry ID's and run a query on the link table to count the total links per cat but I can't see to get it together.
Any ideas or help would be greatly appreciated!
Thanks for helping the PHP illiterate,
Scott Z.
What I am trying to do is modify a free link system. I have everything working but am trying to add a couple of queries to pull some more info; mainly right now the total number of links per category.
First there is a link table and a category table and I am guessing that I need to work something out together. Both tables have a cat ID in them and I need to get them working together to pull the results but don't know how.
If I do this, I get the total number of categories:
$countcats="SELECT COUNT(id) FROM categories WHERE visible='1'";
$countcatsresult=mysql_query($countcats);
$countcatsrow=mysql_fetch_row($countcatsresult);
If I do this I can get the total number of links:
$countquery="SELECT COUNT(id) FROM links WHERE visible='1'";
$countresult=mysql_query($countquery);
$countrow=mysql_fetch_row($countresult);
Now I need to take each of the cateogry ID's and run a query on the link table to count the total links per cat but I can't see to get it together.
Any ideas or help would be greatly appreciated!
Thanks for helping the PHP illiterate,
Scott Z.