<?php
	require('../config/dbcon');
	if(!$connect) {
		echo "Error : Unable to open database\n";
	} else {
		//echo "Opened database successfully\n";
	}	 
	$ifexists = "SELECT EXISTS (SELECT table_name FROM information_schema.tables WHERE table_name = 'COMPANY')";
	$ret = mysqli_query($connect, $ifexists);
if(!$ret) {
	
		$sql =<<<EOF
		CREATE TABLE IF NOT EXISTS COMPANY (ID INT PRIMARY KEY NOT NULL,NAME TEXT NOT NULL,AGE INT NOT NULL,ADDRESS CHAR(50),SALARY REAL);
EOF;
	$crtable = mysqli_query($connect, $sql);
	if(!$crtable) {
		echo mysqli_last_error($connect);
	} else {
		//echo "Table created successfully\n";
	}   
		$sql =<<<EOF
		INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) VALUES (1, 'Paul', 32, 'California', 20000.00 );
		INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) VALUES (2, 'Allen', 25, 'Texas', 15000.00 );
		INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) VALUES (3, 'Teddy', 23, 'Norway', 20000.00 );
		INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) VALUES (4, 'Mark', 25, 'Rich-Mond ', 65000.00 );
EOF;
	$insert = mysqli_query($connect, $sql);
	if(!$insert) {
		echo mysqli_last_error($connect);
	} else {
		echo "Records created successfully\n";
	}
	
}
   mysqli_close($connect);
?>
<!DOCTYPE html>
<html>
<head>
<title>Main Menu</title>
<script type="text/javascript">
    function preventBack() { window.history.forward(); }
	setTimeout("preventBack()", 0);
    window.onunload = function () { null };
</script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src='../js/jquery-3.1.1.min.js' type='text/javascript'></script>
<script src='../js/jquery-ui.min.js' type='text/javascript'></script>
<link href="../css/style.css" rel="stylesheet" />
<link href='../css/jquery-ui.min.css' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../css/all.css">
<link href="../css/bootstrap.min.css" rel="stylesheet" />
<style>
body {
  font-family: Arial, Helvetica, sans-serif;
}
.navbar {
  overflow: hidden;
  background-color: #007bff;
}
.navbar a {
  float: left;
  font-size: 16px;
  color: white;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
}
.dropdown {
  float: left;
  overflow: hidden;
}
.dropdown .dropbtn {
  font-size: 16px;  
  border: none;
  outline: none;
  color: white;
  padding: 14px 16px;
  background-color: inherit;
  font-family: inherit;
  margin: 0;
}
.navbar a:hover, .dropdown:hover .dropbtn {
  background-color: #4c97f6;
}
.dropdown-content {
  display: none;
  position: absolute;
  background-color: #249ee4;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
}
.dropdown-content a {
  float: none;
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
}
.dropdown-content a:hover {
  background-color: #4c97f6;
}
.dropdown:hover .dropdown-content {
  display: block;
}
table, th, td {
  border: 1px solid lightgray;
  padding:5px !important;
}
#fa fa-fw fa-search {
    width: 20em;  height: 1em;
}
body {
  font-family: Arial, Helvetica, sans-serif;
}
table, th, td {
  border: 1px solid lightgray;
  padding:5px !important;
}
#fa fa-fw fa-search {
    width: 20em;  height: 1em;
}
body {
  font-family: Arial, Helvetica, sans-serif;
}
</style>
</head>
<body>
<div "height:10px;" class="navbar">	
	<a onclick=href="../main/index" id="btn-primary style=width: 150px; height: 70px;" class="btn btn-indigo"></i>Home</a>
	<a style = "font-size:20px; width: 85%;"></i>Swastik Sales Corporation, Surat. 9377811610</a>
</div>
<br>
</div>
</body>
</html>
<?php
/*
$db = new SQLite3('test.db');
echo "<!DOCTYPE html>\n";
echo "<html lang=\"en\">\n";
echo "<body>\n";
echo "<table>\n";
echo "<tr><th>partno</th><th>description_one</th>";
echo "<th>description_two</th><th>list</th></tr>\n";
$results = $db->query('SELECT * FROM item_mst limit 10000');
while ($row = $results->fetchArray()) {
    echo "
	<tr>
		<td>" .$row['partno']."</td>
		<td>" .$row['description_one']."</td>
		<td>" .$row['description_two']. "</td>
		<td>" .$row['list']."</td>
	</tr>\n";
}
echo "</table>\n";
echo "</body>\n";
echo "</html>";
*/
?>

<?php phpinfo(); ?>
