Trying to find out how to add sort option of my mysql results that are fetched with Ajax functionality. Sorting by mysql columns or something. Below are some "th" sections where I would like to have sorting options implemented.
HTML page
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tool details</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
<input type="text" name="search_text" id="search_text" placeholder="Search for tool details" class="form-control" />
<div id="result"></div>
<script>
$(document).ready(function(){
load_data();
function load_data(query)
{
$.ajax({
url:"fetch.php",
method:"POST",
data:{query:query},
success:function(data) {
$('#result').html(data);
}
});
}
$('#search_text').keyup(function(){
var search = $(this).val();
if(search != '') {
load_data(search);
} else {
load_data();
}
});
});
</script>
</body>
</html>
Please not that sorting is added only for ID column at the moment to avoid complicating code here.
fetch.php
<?php
//fetch.php
include($_SERVER['DOCUMENT_ROOT'].'/db/connect-db.php');
$output = '';
if(isset($_POST["query"])) {
$search = mysqli_real_escape_string($connection, $_POST["query"]);
$query = "SELECT * FROM tools
WHERE toolsn LIKE '%".$search."%'
OR toolcategory LIKE '%".$search."%'
OR tooldesc LIKE '%".$search."%'
OR toolpn LIKE '%".$search."%'
OR toolstatus LIKE '%".$search."%'";
} else {
$query = "SELECT * FROM tools ORDER BY id";
}
$result = mysqli_query($connection, $query);
//get feedback why database not working
if (!$result) {
printf("Error: %s\n", mysqli_error($connection));
exit();
}
if(mysqli_num_rows($result) > 0) {
$output .= '
<div class="table-responsive">
<table class="table table bordered">
<tr>
<th>Customer Name</th>
<th>Address</th>
<th>City</th>
<th>Postal Code</th>
<th>Country</th>
</tr>';
while($row = mysqli_fetch_array($result)) {
$output .= '<tr>
<td>'.$row["tooldesc"].'</td>
<td>'.$row["toolcategory"].'</td>
<td>'.$row["toolsn"].'</td>
<td>'.$row["toolpn"].'</td>
<td>'.$row["toolstatus"].'</td>
</tr>';
}
echo $output;
}else {
echo 'Data Not Found';
}
?>
I have managed to reproduce sorting option with below code, but this works only if I directly access fetch.php page.
When I tried to fetch details through my html page (over the script) only results are shown, but without sorting function (hyperlinks are not working)
Probably because below code cant read two strings because fetch.php is included in parent html page.
$query = "SELECT * FROM tools ORDER BY " . $orderBy . " " . $order;
so $orderby and $order are not giving command to $query because it is not directly accessed page. Script from html page is reading results from fetch.php.
fetch.php
<?php
//fetch.php
include($_SERVER['DOCUMENT_ROOT'].'/db/connect-db.php');
$orderBy = "id";
$order = "asc";
if(!empty($_GET["orderby"])) {
$orderBy = $_GET["orderby"];
}
if(!empty($_GET["order"])) {
$order = $_GET["order"];
}
$idNextOrder = "asc";
$tooldescNextOrder = "asc";
$toolcategoryNextOrder = "asc";
$toolsnNextOrder = "asc";
$toolpnNextOrder = "asc";
$toolstatusNextOrder = "asc";
if($orderBy == "id" and $order == "asc") {
$idNextOrder = "desc";
}
if($orderBy == "tooldesc" and $order == "asc") {
$tooldescNextOrder = "desc";
}
if($orderBy == "toolcategory" and $order == "asc") {
$toolcategoryNextOrder = "desc";
}
if($orderBy == "toolsn" and $order == "asc") {
$toolsnNextOrder = "desc";
}
if($orderBy == "toolpn" and $order == "asc") {
$toolpnNextOrder = "desc";
}
if($orderBy == "toolstatus" and $order == "asc") {
$toolstatusNextOrder = "desc";
}
$output = '';
if(isset($_POST["query"]))
{
$search = mysqli_real_escape_string($connection, $_POST["query"]);
$query = "
SELECT * FROM tools
WHERE toolsn LIKE '%".$search."%'
OR toolcategory LIKE '%".$search."%'
OR tooldesc LIKE '%".$search."%'
OR toolpn LIKE '%".$search."%'
OR toolstatus LIKE '%".$search."%'
";
}
else
{
//$query = "SELECT * FROM tools";
$query = "SELECT * FROM tools ORDER BY " . $orderBy . " " . $order;
}
$result = mysqli_query($connection, $query);
//get feedback why database not working
if (!$result) {
printf("Error: %s\n", mysqli_error($connection));
exit();
}
if(mysqli_num_rows($result) > 0)
{
$output .= '
<div class="table-responsive">
<table class="table table bordered">
<tr>
<th class="id"><a title="Sort by system ID" href="?orderby=id&order='.$idNextOrder.'">ID</a></th>
<th class="toolsn"><a title="Sort by tool serial number" href="?orderby=toolsn&order='.$toolsnNextOrder.'">Tool SN</a></th>
<th class="toolpn"><a title="Sort by tool part number" href="?orderby=toolpn&order='.$toolpnNextOrder.'">Tool PN</a></th>
<th class="toolcategory"><a title="Sort by tool category" href="?orderby=toolcategory&order='.$toolcategoryNextOrder.'">Tool category</a></th>
<th class="tooldesc"><a title="Sort by tool description" href="?orderby=tooldesc&order='.$tooldescNextOrder.'">Tool description</a></th>
<th class="toolstatus"><a title="Sort by tool status" href="?orderby=toolstatus&order='.$toolstatusNextOrder.'">Tool status</a></th>
<th class="options"></th>
</tr>
';
while($row = mysqli_fetch_array($result))
{
$output .= '
<tr>
<td>'.$row["id"].'</td>
<td>'.$row["toolsn"].'</td>
<td>'.$row["toolpn"].'</td>
<td>'.$row["toolcategory"].'</td>
<td>'.$row["tooldesc"].'</td>
<td>'.$row["toolstatus"].'</td>
<td></td>
</tr>
';
}
echo $output;
}
else
{
echo 'Data Not Found';
}
?>
Related
I am new to jQuery DataTable. Here just I am trying to get the records from the database using DataTable. Also I am using a custom filter for advance searching option.
But the case is records doesn't fetch from the database. It always shows in the bottom of the table like: Showing 0 to 0 of 0 entries (filtered from 2 total entries). Nothing error occurred while processing.
Here is the HTML code.
<div class="col-sm-4">
<div class="form-group">
<label>Enter Appointment Date </label>
<input class="form-control" type="date" id="dates" name="dates">
<span id="type" class="info text-danger"></span><br />
</div>
</div>
<table id="example" style="width:100%" class="table table-hover">
<thead>
<tr>
<th>Apt ID</th>
<th>Doctor</th>
<th>Specialist</th>
<th>Patient</th>
<th>Type</th>
<th>Apt.Date</th>
<th>Status</th>
<th>Change</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<th>Apt ID</th>
<th>Doctor</th>
<th>Specialist</th>
<th>Patient</th>
<th>Type</th>
<th>Apt.Date</th>
<th>Status</th>
<th>Change</th>
<th>Action</th>
</tr>
</tbody>
</table>
Here is the query;
$(document).ready(function () {
fill_datatable();
function fill_datatable(dates = '')
{
var dataTable = $('#example').DataTable({
"processing" : true,
"serverSide" : true,
"order" : [],
"searching" : false,
"ajax" : {
url:"adminquery/fetch/appointment/fetch_appointment.1.php",
type:"POST",
data:{
dates:dates
}
}
});
}
$('#dates').change(function(){
var dates = $('#dates').val();
if(dates != '')
{
$('#example').DataTable().destroy();
fill_datatable(dates);
}
else
{
$('#example').DataTable().destroy();
fill_datatable();
}
});
Below is the fetch.php
$conn = new PDO("mysql:host=localhost;dbname=hmsproject", "root", "");
$columns= array('apt_id','username','specilization','patient_name','type','apt_date','admin_status','Change');
// $query = "SELECT * FROM appointment as a,users as u WHERE a.user_id= u.user_id";
$query = " SELECT * FROM appointment as a INNER JOIN doctor_schedule as d ON a.user_id=d.user_id";
if(isset($_POST['dates'] ))
{
$query .= 'AND a.apt_date = "'.$_POST['dates'].'"
';
}
if(isset($_POST['order']))
{
$query .= 'ORDER BY '.$column[$_POST['order']['0']['column']].' '.$_POST['order']['0']['dir'].' ';
}
else
{
$query .= 'ORDER BY No DESC ';
}
$query1 = '';
if($_POST["length"] != -1)
{
$query1 = 'LIMIT ' . $_POST['start'] . ', ' . $_POST['length'];
}
$statement = $conn->prepare($query);
$statement->execute();
$number_filter_row = $statement->rowCount();
$statement = $conn->prepare($query . $query1);
$statement->execute();
$result = $statement->fetchAll();
$data = array();
foreach($result as $row)
{
$sub_array = array();
$sub_array[] = $row['apt_id'];
$sub_array[] = $row['doctor_name'];
$sub_array[] = $row['specilization'];
$sub_array[] = $row['patient_name'];
$sub_array[] = $row['type'];
$sub_array[] = $row['apt_date'];
$sub_array[] =' <span class="custom-badge status-red">Cancelled</span>';
$data[] = $sub_array;
}
function count_all_data($conn)
{
$query = "SELECT * FROM appointment as a INNER JOIN doctor_schedule as d ON a.user_id=d.user_id";
$statement = $conn->prepare($query);
$statement->execute();
return $statement->rowCount();
}
$output = array(
"draw" => intval($_POST["draw"]),
"recordsTotal" => count_all_data($conn),
"recordsFiltered" => $number_filter_row,
"data" => $data
);
echo json_encode($output);
The debug shows like:
{draw: 1, recordsTotal: 2, recordsFiltered: 0, data: []} data: []
draw: 1 recordsFiltered: 0 recordsTotal: 2
I don't know where I went wrong. Actually I am new to this. Any help may highly appreciated.
is your connection query is right?
see you should not directly use ajax data / datatables >>> first of all see what output your page generating in your case check : url:"adminquery/fetch/appointment/fetch_appointment.1.php"
and use static values for Data table, if both working fine then only go further
I wanted to display sortable tables on my page but it returns no records and I cannot see where is the problem
<?php
$mysqli = new MySQli('localhost', 'root', '', 'statystyki');
if (isset($_GET['order'])) {
$order = $_GET['order'];
} else {
$order = 'ID';
}
if (isset($_GET['sort'])) {
$sort = $_GET['sort'];
} else {
$sort = 'ASC';
}
$resultSet = $mysqli->query("SELECT ID, Gracz FROM rank ORDER BY $order $sort");
if ($resultSet->num_rows > 0) {
$sort == 'DESC' ? $sort = 'ASC' : $sort = 'DESC';
echo "
<table border='1'>
<tr>
<th><a href='?order=ID&&sort=$sort'>ID</a></th>
<th><a href='?order=sn&&sort=$sort'>Gracz</a></th>
";
while ($rows = $resultSet->fetch_assoc()) {
$ID = $rows['ID'];
$sn = $rows['Gracz'];
echo "
<tr>
<td>$ID</td>
<td>$sn</td>
</tr>
";
}
echo "
</table>
";
} else {
echo "No records";
}
What is solution?
I'm creating a simple transactions report page that takes inputted database data and displays it on an HTML table. I want to be able to sort each column on the client side in asc/desc order when the table header is clicked upon, but I can't get my functions to work.
<?php session_start();
include 'db.php';
include 'head.php';
$sql = "SELECT * FROM ach";
$result = $mysqli->query($sql);
echo "<div class='w3-row-padding w3-margin'>";
if ($result->num_rows) {
echo "<table class='w3-table-all'>
<thead>
<tr>
<th><a href='transactions.php?sort=submittedDate'>Submitted Date</a></th>
<th><a href='transactions.php?sort=accountNumber'>Chief Account Number</a></th>
<th><a href='transactions.php?sort=accountHolderName'>Account Holder</a></th>
<th><a href='transactions.php?sort=achAccountType'>Account Type</a></th>
<th><a href='transactions.php?sort=transferType'>Transfer Type</a></th>
<th><a href='transactions.php?sort=recurringMonthlyTransferDate'>Transfer Date</a></th>
<th><a href='transactions.php?sort=status'>Status</a></th>
<th> </th>
</tr>
</thead>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tbody><tr><td>".$row["submitDate"]."</td><td>".$row["accountNumber"]."</td><td>".$row["accountHolderName"]."</td><td>".$row["achAccountType"]."</td><td>".$row["transferType"]."</td><td>".$row["recurringMonthlyTransferDate"]."</td><td>".$row["status"]."</td><td>Review</td></tr></tbody>";
}
echo "</table>";
} else {
echo "0 results";
}
echo "</div>";
if ($_GET['sort'] == 'submittedDate')
{
$sql .= " ORDER BY `ach`.`submitDate` ASC ";
}
elseif ($_GET['sort'] == 'accountNumber')
{
$sql .= " ORDER BY accountNumber";
}
elseif ($_GET['sort'] == 'accountHolderName ')
{
$sql .= " ORDER BY accountHolderName ASC";
}
elseif($_GET['sort'] == 'achAccountType')
{
$sql .= " ORDER BY achAccountType";
}
elseif($_GET['sort'] == 'transferType')
{
$sql .= " ORDER BY transferType";
}
elseif($_GET['sort'] == 'recurringMonthlyTransferDate')
{
$sql .= " ORDER BY recurringMonthlyTransferDate";
}
elseif($_GET['sort'] == 'status')
{
$sql .= " ORDER BY status";
}
$mysqli->close();
include 'foot.php';
?>
You must add your sorting statements BEFORE you execute the query. Query is executed on this line:
$result = $mysqli->query($sql);
If you want to sort data at server end you have to use order by clause. If you want jquery to sort at client end you can use Data tables
Also put <tbody> </tbody> outside the while. your table is having many tbody tags as there are many rows.
$sort = "";
if(isset($_GET["sort"])) {
$sort = $_GET["sort"];
//validate that it is real column name so that you will not get any error
if(!in_array($sort, array("submittedDate", "accountNumber", "accountHolderName", "achAccountType", "transferType", "recurringMonthlyTransferDate", "status"))) {
$sort = "";
}
if($sort !="") {
$sort = " order by ".$sort." ASC";
}
}
$sql = "SELECT * FROM ach".$sort;
I have been trying to make a search engine where I have two inputfields, both are searching in the same database and table but different rows/columns. My problem is they both search in both rows/columns. I'm adding screenshots at the bottom so you can understand me better.
I'm suspecting there's something wrong the functions in document 2, but I can't understand what.
Here's the code in two documents.
Document 1
mysql_connect ("localhost","xxxx","xxxx") or die ("Tilkoblingsfeil");
mysql_select_db ("xxxx") or die("Finner ikke database");
$output = '';
if(isset($_POST['searchVal'])) {
$searchq = $_POST['searchVal'];
$searchq = preg_replace ("#^0-9#"," ",$searchq);
$query = mysql_query("SELECT * FROM ds_OrderItem WHERE idProduct LIKE '%$searchq%' LIMIT 100") or die("Klarte ikke søke!");
$count = mysql_num_rows ($query);
if($count == 0){
$output = 'Ingen produktID med disse verdiene';
}else{
$output .='<table border="1" cellpadding="5" cellspacing="1" width="50%" bordercolor="grey"><tr><th>ProduktID</th><th>Ordrenummer</th><th>Beskrivelse</th><th>Antall</th>';
while($row = mysql_fetch_array($query)) {
$output .= '<tr><td>'.$row['idProduct'].'</td><td>'.$row['idOrder'].'</td><td>'.$row['title'].'</td><td>'.$row['qty'].'</td></tr>';
}
$output .='</table>';
if($_POST['searchVal'] == NULL) {
$output = "";
}
}
}
if(isset($_POST['searchVal'])) {
$searchw = $_POST['searchVal'];
$searchw = preg_replace ("#^0-9a-z#i"," ",$searchw);
$query = mysql_query("SELECT * FROM ds_OrderItem WHERE title LIKE '%$searchw%' LIMIT 100") or die("Klarte ikke søke!");
$count = mysql_num_rows ($query);
if($count == 0){
$output = 'Ingen TECDOC artikler med disse verdiene';
}else{
$output .='<table border="1" cellpadding="5" cellspacing="1" width="50%" bordercolor="grey"><tr><th>ProduktID</th><th>Ordrenummer</th><th>Beskrivelse</th><th>Antall</th>';
while($row = mysql_fetch_array($query)) {
$output .= '<tr><td>'.$row['idProduct'].'</td><td>'.$row['idOrder'].'</td><td>'.$row['title'].'</td><td>'.$row['qty'].'</td></tr>';
}
$output .='</table>';
if($_POST['searchVal'] == NULL) {
$output = "";
}
}
}
echo ($output);
?>
Document 2
<?php
error_reporting(1);
include('system_admin.inc.php');
make_header($title,array('enable_ajax' => true));
?>
<html>
<head>
<title>TecdocORProduct</title>
<script type=text/javascript " src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type=text/javascript ">
function searchq() {
var searchTxt = $("input[name='search1']").val();
$.post("testsearch.php", {searchVal: searchTxt}, function(output) {
$("#output") .html(output);
});
}
function searchw() {
var searchTxt = $("input[name='search2']").val();
$.post("testsearch.php", {searchVal: searchTxt}, function(output) {
$("#output") .html(output);
});
}
</script>
</head>
<body>
<h1>Søk i produktID eller tecdocnr</h1>
<form class="odd" action="william.properties.php" method="post">
<input type="text" name="search1" placeholder="Søk etter produktID" onkeyup="searchq();" />
<form class="odd" action="william.properties.php" method="post">
<input type="text" name="search2" placeholder="Søk etter tecdocnr" onkeyup="searchw();" />
<div id="output">
</div>
</form>
</body>
</html>
Thank you for your time and any answers I might be given.
You should use unique keys for your both search request's {searchVal: searchTxt} or {searchVal2: searchTxt} and use in php search conditions accordingly
Try changing your js and php code like below:
JS:
function searchq() {
var searchTxt = $("input[name='search1']").val();
$.post("testsearch.php", {searchVal: searchTxt}, function(output) {
$("#output") .html(output);
});
}
function searchw() {
var searchTxt = $("input[name='search2']").val();
$.post("testsearch.php", {searchVal2: searchTxt}, function(output) {
$("#output") .html(output);
});
}
Php:
mysql_connect ("localhost","xxxx","xxxx") or die ("Tilkoblingsfeil");
mysql_select_db ("xxxx") or die("Finner ikke database");
$output = '';
if(isset($_POST['searchVal'])) {
$searchq = $_POST['searchVal'];
$searchq = preg_replace ("#^0-9#"," ",$searchq);
$query = mysql_query("SELECT * FROM ds_OrderItem WHERE idProduct LIKE '%$searchq%' LIMIT 100") or die("Klarte ikke søke!");
$count = mysql_num_rows ($query);
if($count == 0){
$output = 'Ingen produktID med disse verdiene';
}else{
$output .='<table border="1" cellpadding="5" cellspacing="1" width="50%" bordercolor="grey"><tr><th>ProduktID</th><th>Ordrenummer</th><th>Beskrivelse</th><th>Antall</th>';
while($row = mysql_fetch_array($query)) {
$output .= '<tr><td>'.$row['idProduct'].'</td><td>'.$row['idOrder'].'</td><td>'.$row['title'].'</td><td>'.$row['qty'].'</td></tr>';
}
$output .='</table>';
if($_POST['searchVal'] == NULL) {
$output = "";
}
}
exit($output);
}
if(isset($_POST['searchVal2'])) {
$searchw = $_POST['searchVal2'];
$searchw = preg_replace ("#^0-9a-z#i"," ",$searchw);
$query = mysql_query("SELECT * FROM ds_OrderItem WHERE title LIKE '%$searchw%' LIMIT 100") or die("Klarte ikke søke!");
$count = mysql_num_rows ($query);
if($count == 0){
$output = 'Ingen TECDOC artikler med disse verdiene';
}else{
$output .='<table border="1" cellpadding="5" cellspacing="1" width="50%" bordercolor="grey"><tr><th>ProduktID</th><th>Ordrenummer</th><th>Beskrivelse</th><th>Antall</th>';
while($row = mysql_fetch_array($query)) {
$output .= '<tr><td>'.$row['idProduct'].'</td><td>'.$row['idOrder'].'</td><td>'.$row['title'].'</td><td>'.$row['qty'].'</td></tr>';
}
$output .='</table>';
if($_POST['searchVal'] == NULL) {
$output = "";
}
}
exit($output);
}
?>
You need to differentiate the post data name { idproduct : searchTxt} and { title:searchtxt }
JS :
function searchq() {
var searchTxt = $("input[name='search1']").val();
$.post("testsearch.php", {idproduct: searchTxt}, function(output) {
$("#output") .html(output);
});
}
function searchw() {
var searchTxt = $("input[name='search2']").val();
$.post("testsearch.php", {title: searchTxt}, function(output) {
$("#output") .html(output);
});
}
PHP :
if(isset($_POST['idproduct'])) { .... }
if(isset($_POST['title'])) { .... }
Hello I'm new in PHP and MYSQL . Want to learn More. Today I'm Facing some problem like update the value into database. But I solved it out. My code update each row's specific column name 'status' into database. But it still show me same value in page
<div class="widget-body" style="height: 290px;">
<table class="table ">
<thead>
<tr>
<th>User Name</th>
<th>Starts</th>
<th>Length</th>
<th>Status</th>
<th>Update</th>
</tr>
</thead>
<tbody>
<?php
include 'sql.php';
$result = mysql_query("SELECT vacation.id, vacation.start_date, vacation.length, vacation.status, userinfo.* FROM vacation INNER JOIN userinfo ON vacation.user_id = userinfo.user_id ");
if ($result === FALSE) {
die(mysql_error()); // TODO: better error handling
}
while ($db_field = mysql_fetch_assoc($result)) {
$id = $db_field['id'];
$uid = $db_field['user_id'];
$uname = $db_field['username'];
$sdate = $db_field['start_date'];
$len = $db_field['length'];
$stat = $db_field['status'];
echo("<tr>");
echo("<td>$uname</td>");
echo("<td>$sdate</td>");
echo("<td>$len</td>");
echo("<td>$stat</td>");
?> <td>
<form method='post' action = '<?php echo $_SERVER['PHP_SELF'];?>' >
<input type='hidden' name="vacation_id" value='<?php echo $id; ?>'/>
<button type='submit' class='btn btn-success btn-mini' name='btn-accept' >Accept</button>
</form>
<form method='post' action = '<?php echo $_SERVER['PHP_SELF'];?>' >
<input type='hidden' name="vacation_id" value='<?php echo $id; ?>'/>
<button type='submit' class='btn btn-danger btn-mini' name='btn-deny' >Deny</button>
</form>
</td><?php
echo("</tr>");
} //end while-loop
?>
<?php
if (isset($_POST['btn-accept'])) {
$v_id = $_POST['vacation_id'];
$SQL = "UPDATE vacation SET status = 1 WHERE id = $v_id ";
$result = mysql_query($SQL);
if ($result === FALSE) {
die(mysql_error()); // TODO: better error handling
}
}
if (isset($_POST['btn-deny'])) {
$v_id = $_POST['vacation_id'];
$SQL = "UPDATE vacation SET status = 0 WHERE id = $v_id ";
$result = mysql_query($SQL);
if ($result === FALSE) {
die(mysql_error()); // TODO: better error handling
}
}
?>
</tbody>
</table>
</div>
I know its very old but I'm learning. Thanks in advance.
I mean a little like this:
if (isset($_POST['btn-accept'])) {
$v_id = $_POST['vacation_id'];
$SQL = "UPDATE vacation SET status = 1 WHERE id = $v_id ";
$result = mysql_query($SQL);
if ($result === FALSE) {
die(mysql_error()); // TODO: better error handling
}
}
if (isset($_POST['btn-deny'])) {
$v_id = $_POST['vacation_id'];
$SQL = "UPDATE vacation SET status = 0 WHERE id = $v_id ";
$result = mysql_query($SQL)
if ($result === FALSE) {
die(mysql_error()); // TODO: better error handling
}
}
$result = mysql_query("SELECT vacation.id, vacation.start_date, vacation.length, vacation.status, userinfo.* FROM vacation INNER JOIN userinfo ON vacation.user_id = userinfo.user_id ");
if ($result === FALSE) {
die(mysql_error()); // TODO: better error handling
}
while ($db_field = mysql_fetch_assoc($result)) {