Stevis2002 Posted April 3, 2005 Share Posted April 3, 2005 Hi all, this is probably really obvious, but how can i show the total amount of products in database? I'm not sure which query to use to pull this infor from the database. I wish to put it in the footer bar, opposite the date Thanks, Steve Link to comment Share on other sites More sharing options...
Stevis2002 Posted April 3, 2005 Author Share Posted April 3, 2005 Anybody any ideas? I'm not sure which database table contains the total products, or how to extract the total products so i can relay it to the page Link to comment Share on other sites More sharing options...
Stevis2002 Posted April 3, 2005 Author Share Posted April 3, 2005 would i need to add another table into the sql? Link to comment Share on other sites More sharing options...
Stevis2002 Posted April 4, 2005 Author Share Posted April 4, 2005 Sorry to blatently bump the topic, but i was just wondering if anybody did know this piece of code, as i'm sure it isn't too difficult to do for you guys. Thanks, Steve Link to comment Share on other sites More sharing options...
burt Posted April 4, 2005 Share Posted April 4, 2005 SELECT COUNT(`products_id`) FROM `products` WHERE `products_status` = 1 Link to comment Share on other sites More sharing options...
Stevis2002 Posted April 4, 2005 Author Share Posted April 4, 2005 SELECT COUNT(`products_id`) FROM `products` WHERE `products_status` = 1 <{POST_SNAPBACK}> Thank You, You are a star! Steve How would i show the result then? Do i just place that code where i want the result to show, or is there a certain code block to use? Link to comment Share on other sites More sharing options...
Stevis2002 Posted April 4, 2005 Author Share Posted April 4, 2005 Ok, I think i've nearly got it, but i just got a parse error now. The code i'm using is:- function tep_get_products_total($product_id, $language = '') { global $languages_id; if (empty($language)) $language = $languages_id; $product_query = tep_db_query("select COUNT('products_id') from " . TABLE_PRODUCTS_DESCRIPTION . " where products_status = 1; $product = tep_db_fetch_array($product_query); return $product['products_total']; } And then i'm trying to display the output with this line.... <?php echo $products_total;?> Any ideas where the problem is? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.