i have some categories of my website i want to show number of inputs in specific category it is smiler when we see a link directory on category name we usually see how many links are in this category or regarding this forum from main we can see how many threads and posts a forum has please help how to do this math my site is in PHP and database is SQL regards
Adapt to this : $result = mysql_query("SELECT COUNT(*) AS nr FROM category_table WHERE category_id = NUMBER"); $row = mysql_fetch_array($result); echo $row['nr']; PHP:
thanks tvoodoo it gives this error Notice: Undefined index: nr in /usr/home/user/domains/domian.com/public_html/categories.php on line 30 Code (markup): how ever this worked fine for me $result = mysql_query("SELECT COUNT(*) FROM category_table WHERE category_id = NUMBER"); $row = mysql_fetch_array($result,MYSQL_BOTH); echo $row['0']; Code (markup): anyway thanks for your great help
you should have replaced category_table with your table name and the value NUMBER with a existing category id number !