dannybrazil Posted April 12, 2008 Share Posted April 12, 2008 Hello in my site (http://www.classifieds-4free.net/portuguese/por-post-categories.php?city=Toronto) i have all the categories as a link (as you can see) but only in the next page after you hit a category you can see all the posts. i wanted to know if its possible to get the number of posts of each category in this page ? (e.g Books (12) , and so on...) i know i suppose to connect to the database and do the regular count of rows , in my next pageit looks like that : $data = mysql_query("SELECT * FROM _Form_Nr_4 WHERE category='$category' AND city='$city' ORDER BY post_time DESC") or die as you can see all the posts r in one database and for each city and category(link farwarded) there is another quering. well i hope you understand what im asking thanks Link to comment https://forums.phpfreaks.com/topic/100820-php-code-help/ Share on other sites More sharing options...
dannybrazil Posted April 12, 2008 Author Share Posted April 12, 2008 can i do the query for each category and just show it as a number? Link to comment https://forums.phpfreaks.com/topic/100820-php-code-help/#findComment-515616 Share on other sites More sharing options...
poleposters Posted April 12, 2008 Share Posted April 12, 2008 $data = mysql_query("SELECT * FROM _Form_Nr_4 WHERE category='$category' AND city='$city' ORDER BY post_time DESC") or die $number=mysql_num_rows($data); That will get you the number of records retrieved for a particular category Then all you have to do is print "$number"; Next to the category list Link to comment https://forums.phpfreaks.com/topic/100820-php-code-help/#findComment-515684 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.