<?php
error_reporting(-1);
ini_set('display_errors', 'On');
?>
<?php
$title = "Job Role Description";
include ( 'includes/header.php' );
?>
</head>
<body>
<div id="container">
<?php
/*
VIEW.PHP
Displays all data from 'jobs' table
*/
// connect to the database
//include('connect-db.php');
$con = mysqli_connect("","","","");
// get results from database
$id = '';
if(isset($_GET['id'])){ $id = $_GET['id'];}
$query = "SELECT id, ref, role, division, location, salary, description FROM jobs WHERE division='IT' AND id = " . ((!empty($id)) ? $id : "(SELECT min(id) from jobs)") . " ORDER BY id desc LIMIT 1";
$result = mysqli_query($con, $query) or die("Error: ".mysqli_error($con));
// display data in table
// loop through results of database query, displaying them in the table
while($row = mysqli_fetch_array( $result )) {
// echo out the contents of each row into a table
echo "<table border='1' cellpadding='10' class='jobpagetable'>";
echo "<tr><th class='jobpage'>Ref</th><td>". $row['ref'] . "</td></tr>";
echo '<tr></tr><tr></tr>';
echo "<tr><th class='jobs'>Role</th><td>" . $row['role'] . '</td></tr>';
echo '<tr></tr><tr></tr>';
echo "<tr><th class='jobs'>Division</th><td>" . $row['division'] . '</td></tr>';
echo '<tr></tr><tr></tr>';
echo "<tr><th class='jobs'>Location</th><td>" . $row['location'] . '</td></tr>';
echo '<tr></tr><tr></tr>';
echo "<tr><th class='jobs'>Salary</th><td>" . $row['salary'] . '</td></tr>';
echo '<tr></tr><tr></tr>';
echo "<tr><th class='jobs'>Description</th><td>" . $row['description'] . '</td></tr>';
echo '<tr></tr><tr></tr>';
echo "<td><a class='applylinks' href='apply.php?id=" .$row['id']."'>Apply</a></td>";
echo "</tr>";
}
// close table>
echo "</table>";
?>
</div>
</body>
</html>