<?php
/** ensure this file is being included by a parent file */
defined( '_VALID_' ) or die( 'Direct Access to this location is not allowed.' );

//ส่วนการสร้างตารางระบบย่อย
$sql_create="CREATE TABLE `bookpv_permission` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `person_id` varchar(13) NOT NULL,
  `p1_book` tinyint(4) NOT NULL,
  `p2_book` tinyint(4) NOT NULL,
  `officer` varchar(13) NOT NULL,
  `rec_date` date NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `person_id` (`person_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1" ;
$query = mysqli_query($connect,$sql_create);

$sql_create="CREATE TABLE `bookpv_sync` (
  `id` int(11) NOT NULL,
  `pmss_url` varchar(100) NOT NULL,
  `sync_code` varchar(50) NOT NULL,
  `officer` varchar(13) NOT NULL,
  `rec_date` date NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8" ;
$query = mysqli_query($connect,$sql_create);

$sql_create="INSERT INTO `bookpv_sync` VALUES (1, 'http://xxx.xxx.xxx.xxx/pmss', 'xxxx', '', '2017-06-23')" ;
$query = mysqli_query($connect,$sql_create);

?>