<?php
include '../config/database.php';
// header('Content-type: application/json');
date_default_timezone_set("Asia/Bangkok");

function _result($rname,$rtime,$rcategory,$r3unit,$r2unit,$r3unit_vip,$r2unit_vip){
	$conn = _connectDB();
	$sql = "INSERT INTO `05z3l_linebot_demo`.`result`(`rname`, `rtime`, `rcategory`, `r3unit`, `r2unit`, `r3unit_vip`, `r2unit_vip`) VALUES ('".$rname."', '".$rtime."', '".$rcategory."', '".$r3unit."', '".$r2unit."', '".$r3unit_vip."', '".$r2unit_vip."');";
	$result = $conn->query($sql);
}

$rname		= 	$_GET["name"];
$rtime		= 	$_GET["time"];
$rcategory	= 	$_GET["category"];
$r3unit		= 	$_GET["3unit"];
$r2unit		= 	$_GET["2unit"];

$r3unit_vip	= 	$_GET["3unit_vip"];
$r2unit_vip	= 	$_GET["2unit_vip"];

if(trim($rname) != '' AND trim($rtime) != '' AND trim($rcategory) != ''){
	echo "Insert";
	if($r3unit_vip == ''){$r3unit_vip = null;}
	if($r2unit_vip == ''){$r2unit_vip = null;}
	_result($rname,$rtime,$rcategory,$r3unit,$r2unit,$r3unit_vip,$r2unit_vip);
}else{
		echo "param not failed";
}




