-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction_filter.php
More file actions
44 lines (37 loc) · 1.38 KB
/
action_filter.php
File metadata and controls
44 lines (37 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
session_start();
require('database/conection.php');
//require('database/category.php');
//require('database/product.php');
//require('database/suplier.php');
$id_suplier = $_GET["Supplier Select"];
$id_brand = $_GET["Brand Select"];
if($id_suplier=="none" && $id_brand=="none" &&){
$stmt = $dbh->prepare('SELECT * FROM Product');
$stmt->execute();
$result_ = $stmt->fetchAll();
}
elseif ($id_suplier=="none"){
$stmt = $dbh->prepare('SELECT * FROM Product WHERE brand_id=?');
$stmt->execute(array($id_brand));
$result_ = $stmt->fetchAll();
}
elseif ($id_brand=="none"){
$stmt = $dbh->prepare('SELECT * FROM Product
JOIN SupProduct
ON Product.id_product = SupProduct.product_id
WHERE SupProduct.suplier_id = ?');
$stmt->execute(array($id_suplier));
$result_ = $stmt->fetchAll();
}
else {
$stmt = $dbh->prepare('SELECT * FROM Product
JOIN SupProduct
ON Product.id_product = SupProduct.product_id
WHERE SupProduct.suplier_id = ?
AND Product.brand_id = ?');
$stmt->execute(array($id_suplier, $id_brand));
$result_ = $stmt->fetchAll();
}
$_SESSION["session_products"] = $result_;
?>