xprez Posted January 8, 2007 Share Posted January 8, 2007 Hi all.I have done some php scripting, but now i`m stuck! (newbie)I want this ad-script to show the amount of ads in each category on the front page, in "()" behind the category name, and that part is working fine, but how do i get the scipt to get the amount of ads in the subcategories? Someone please help.Belowe is the code of the "index.php" page. The red txt is the part that`s working fine about getting the amount of ads in the main categories, but what about it do i have to change the include the amount of ads in subcategories?<?php include ("session.php"); $nav_section = "search";include ("header.php"); [color=red]get_categories($_GET['cat_id']);get_ads_in_cat($_GET['cat_id'], "full", "");[/color] include ("footer.php"); ?> Quote Link to comment Share on other sites More sharing options...
btherl Posted January 8, 2007 Share Posted January 8, 2007 get_categories() is not part of standard php. You might want to try the "third-party php script" forum. Quote Link to comment Share on other sites More sharing options...
simcoweb Posted January 8, 2007 Share Posted January 8, 2007 yeah, i'm not sure what that is. But, if you want to get a count then you'd have to do a query of some sort that tells you how many results there are. Like this:[code]<?php$sql = "SELECT * FROM categories";$results = mysql_query($sql);$num_rows = mysql_num_rows($results);echo "There are $num_rows ads in this category.";?>[/code]That will return the number of results. Quote Link to comment Share on other sites More sharing options...
xprez Posted January 8, 2007 Author Share Posted January 8, 2007 Thank you for the help so far. I will try to implement the example you have given me. If not that works with my "special" - php script ;D i will try the "third party script" section. ;)Thanks again. Great site by the way! Best regards Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.