Ecommerce Shopify WordPress Discussion

filter php mysql query two dropdown menu

What would be the best query to filter categories and dimensions? For example if selecting cat1 it must find only the dimensions relating to that category. It all has to be connected. <?php require('conn.php'); if(isset($_POST['submit'])){ $name = mysqli_real_escape_string($conn,$_POST['name']); $dim = mysqli_real_escape_string($conn,$_POST['post_excerpt']); $que=mysqli_query($conn,"SELECT * FROM wp_posts wp INNER JOIN wp_term_relationships r ON wp.ID = r.object_id INNER JOIN wp_term_taxonomy tt ON r.term_taxonomy_id = tt.term_taxonomy_id INNER JOIN wp_terms t ON t.term_id = tt.term_id INNER JOIN wp_postmeta pm ON pm.post_id=wp.ID INNER JOIN wp_posts wpv ON wp.ID= wpv.post_parent INNER JOIN wp_wc_product_meta_lookup wl ON wl.product_id=wpv.ID WHERE tt.taxonomy IN ( 'product_cat') and pm.meta_key IN ('_stock','instock','_sku','_price') and wpv.post_type IN ('product_variation','product') and'$name' and wpv.post_excerpt='$dim' GROUP BY wpv.post_title and wpv.post_excerpt" ) or die(mysqli_error()); while($row=mysqli_fetch_array($que)){ echo"<tr><td>".$row['sku']."</td> <td>".$row['post_title']."</td> <td>".$row['stock_quantity']."</td> <td>".$row['rimanenza']."</td> <td>".$row['min_price']."</td> <td>".$row['name']."</td> <td>".$row['post_excerpt']."</td> <td>".$row['post_date']."</td> <td> <a href=\"edit.php?product_id={$row['product_id']}\" alt='edit'> Modifica </a> </tr>";
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.