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
|
<?php //echo $_GET["customer_id"]; include('../../inc/configure.php');
$customer_id = (int)$_GET["customer_id"];
$nowdate = date("Y-m-d");
//get contract data
$sql3 = "SELECT * FROM sup_contract WHERE ? <= contract_to and customer_id = ? and status = ?";
if (!($sth = $dbh->prepare($sql3))) { throw new Exception("sql prepare statement failure: $sql3"); } $sth->setFetchMode(PDO::FETCH_ASSOC); if (!$sth->execute(array($nowdate, $customer_id, "1"))) { throw new Exception("sql execute statement failure: $sql3"); } $contract = $sth->fetch(PDO::FETCH_ASSOC);
if (!empty($contract)) { //search time and contract time overlap echo "Has Valid Contract"; } else { echo "No Valid Contract"; }
|