-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_product_standard.php
43 lines (36 loc) · 1.02 KB
/
get_product_standard.php
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
<?php
session_start();
$table_purchase = 't_purchase_all';
$product_name = $_GET['product_name'];
include '../../conn.php';
try{
if($product_name != null){
//根据公司查询公司对应的产品
$sth = $dbh->prepare("select distinct standard from $table_purchase where
product_name=:product_name
");
$sth->execute(array(
':product_name' => $product_name
));
$items = array();
while($row = $sth->fetch(PDO::FETCH_ASSOC)){
array_push($items,$row);
}
if(count($items) == 0){
$temp['standard'] = "该产品未定规格";
array_push($items,$temp);
}
$result = $items;
}else{
$temp['standard'] = "尚未选择产品";
$items = array();
array_push($items,$temp);
$result = $items;
}
}catch (PDOException $e){
$result = array();
$result['isError'] = $e->getMessage();
echo json_encode($result);
exit;
}
echo json_encode($result);