I am trying to built a search page for products in which i have two table products and inventory, i have my product details in product and inventory details like color,size,price etc in inventory. Please suggest a solution i am really stuck and i need a better solution for a powerful design. Below are all necessary details:
Product:
product_id
product_name
product_sku
product_desc
product_category
Inventory:
inventory_id
product_id
inventory_color
inventory_size
MY QUERY:
SELECT p.product_name, p.product_sku, p.product_desc, i.inventory_color, i.inventory_color
FROM products as p
INNER JOIN invetory as i ON p.product_id = i.product_id
URL:
www.abc.com/index.php?cat=shoe&color=black
How can i get the cat and color from URL and use them in my query? Or am i doing the right way?
You can catch values from an url. you can use " $_GET['parameter'] "
using PDO, something like -
from example at http://www.php.net/manual/en/pdo.prepare.php
Yes, you are in the right path. Get the values from url using
get
orrequest
and make your SQL as
You can get it with $_GET like: