[Solved] Create MySQL query from URL GET parameters [duplicate]


First you need to process the URL using PHP by assigning the URL parameters to PHP variables:

$cat = $_GET['cat'];
$subcat = $_GET['subcat'];
$color= $_GET['color'];

Then you can use these variables to create a MySQL query string:

$queryString = "SELECT a.p_id, a.p_name, a.p_prize, b.p_id b.color, b.category, b.subcategory
FROM products a INNER JOIN details b ON a.p_id=b.p_id WHERE b.category = '" . mysql_real_escape_string( $cat ) . "' AND b.subcategory = '" . mysql_real_escape_string( $subcat ) . "' AND b.color="" . mysql_real_escape_string( $color ) . "" ";

You can then use this query sting to query the database.

4

solved Create MySQL query from URL GET parameters [duplicate]