-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_agency.php
40 lines (31 loc) · 1.37 KB
/
add_agency.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
<?php
/*
*
* http://editablegrid.net
*
* Copyright (c) 2011 Webismymind SPRL
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://editablegrid.net/license
*/
require_once('config.php');
// Database connection
$mysqli = mysqli_init();
$mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 5);
$mysqli->real_connect($config['db_host'],$config['db_user'],$config['db_password'],$config['db_name']);
// Get all parameter provided by the javascript
$agency_name = $mysqli->real_escape_string(strip_tags($_POST['agency_name']));
$agency_owner = $mysqli->real_escape_string(strip_tags($_POST['agency_owner']));
$trd_id = $mysqli->real_escape_string(strip_tags($_POST['trd_id']));
$bnk_drf = $mysqli->real_escape_string(strip_tags($_POST['bnk_drf']));
$val_frm = $mysqli->real_escape_string(strip_tags($_POST['val_frm']));
$val_to = $mysqli->real_escape_string(strip_tags($_POST['val_to']));
$tablename = "agency";
$stmt="s";
$return=false;
if ( $stmt = $mysqli->prepare("INSERT INTO " .$tablename. " (agency_name, agency_owner,trade_id,bank_draft_no,validity_from,validity_till) VALUES ( ? , ? , ? , ? , ? , ? )")) {
$stmt->bind_param("ssssss", $agency_name, $agency_owner,$trd_id,$bnk_drf,$val_frm,$val_to);
$return = $stmt->execute();
$stmt->close();
}
$mysqli->close();
echo $return ? "ok" : "error";