Jump to content

DB Query help


AfterGlow93
 Share

Recommended Posts

Hi, 

I am facing an issue with a module (Leo Parts Filter module), that i use on my website. 

The id_products value here is not an id for a product, i just put an other value here that i can import to this module, which is a ktype to identify car make, model, year, and engine, so i will talk about id_products (ktype) when it comes about it.

The database itself count 5 columns, id_products (ktype) which is my ktype imported, and id for each make, model, year, engine relative to this ktype.

What i want, is get this id_product (ktype) and query the feature database from my shop, to get each id_products from feature id number 212, where the feature value lang = id_product (ktype).

Then, the search script will list all products responding to this query.

$sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'leopartsfilter_product`  WHERE 1=1';
        
        
        if ($id_product != null && (int) $id_product) {
            $sql  = 'AND id_product=' . (int) id_product;

/* I need to query this table to get id_product (which is a ktype stored instead) assignated to the column id_product 
Then, i need to find a matching ktype value stored in a feature value on each product */

If someone already did that and can help me, i'm not good at SQL so don't blame me please.

 

Thanks

Share this post


Link to post
Share on other sites

at the first look - there is missing space in your query: should be

 ' AND...'

instead of

'AND...'
$sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'leopartsfilter_product`  WHERE 1=1';
        
        
        if ($id_product != null && (int) $id_product) {
            $sql  = ' AND id_product=' . (int) id_product;

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More