Re: How to create a Counter for Catagory Items

The nr is half way there, i am trying to get something that works with this script, but i am realy having a hard time...

-

Basicly what i would like to do is add a counter to each catagory telling you how many items are in catagorys.... So that people can see where there are items are where not... because some might be empty and its anoying for a user not to be able to see it

Re: How to create a Counter for Catagory Items

Posted 30 March 2009 - 08:10 PM

// This is the connection to the database, you should already have something along these lines
$link = mysql_connect("localhost", "mysql_user", "mysql_password");
mysql_select_db("database", $link);
// This is the query to the db that selects the column you want to count
$result = mysql_query("SELECT * FROM $table_and_query", $link);
// this is the variable that holds the number of rows within the column
$num_rows = mysql_num_rows($result);
// This echo's out the variable that you created
echo "$num_rows Rows\n";

Re: How to create a Counter for Catagory Items

I am not fully understand where abouts to put the code in the code... You see i am pretty new to this, and well.... its a little foreign to me

If you wouldnt mind telling me where about the code should be placed or where abouts that would help allot.

thank you very much

The pages that richie bee posted above, can you name them for me, so that I know what I can see and what I can't. I can show you where you should throw it in and then echo out your information at least. And just so you know I am no php wizz, so along the way hopefully others will check it out and maybe even give you some helpful tips.