<?php
include('../../conf/conn.php');

$query="select * from coupon where code = '".$_GET["code"]."'";
$result=mysqli_query($conn,$query);
$row=mysqli_fetch_assoc($result);

if($row["start_date"] <= date("Y-m-d") && $row["end_date"] > date("Y-m-d") && $row["usage_count"] > 0){echo $row["discount_rate"];}

?>