Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

doesn't work inside a function


Salvo

Recommended Posts

Hi all

 

I have a function which list all manufactueres. Now I like to have only manufactuerers in a category ie. category id 2.

 

The category id is here $current_category_id it gives an ID = 2 , but inside the function below it returns nothing.. why?

 

Thanks for help

 

function manufacturers_list(){

global $manufacturer;

 

$manufacturers_query = tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name from " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_SPECIALS . " s where m.manufacturers_id = p.manufacturers_id and p.products_id = s.products_id and p.products_id = p2c.products_id and p2c.categories_id = '" . $current_category_id . "' order by manufacturers_name");

 

 

etc etc...

Link to comment
Share on other sites

Hi all

 

I have a function which list all manufactueres. Now I like to have only manufactuerers in a category ie. category id 2.

 

The category id is here $current_category_id it gives an ID = 2 , but inside the function below it returns nothing.. why?

 

Thanks for help

 

function manufacturers_list(){

global $manufacturer;

 

$manufacturers_query = tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name from " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_SPECIALS . " s where m.manufacturers_id = p.manufacturers_id and p.products_id = s.products_id and p.products_id = p2c.products_id and p2c.categories_id = '" . $current_category_id . "' order by manufacturers_name");

etc etc...

 

 

$current_category_id is a global, but you have not declared it ...

 

try this:

 

function manufacturers_list(){
	global $manufacturerm, $current_category_id;

etc etc

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...