<?php
// include Database connection file
include("connectionfile.php");
// Design initial table header
$data = '<table class="table table-bordered table-striped table-hover" id="supplierTable" style="max-width: 1000px">
<thead>
<tr>
<th>No</th>
<th>Sym</th>
<th>Name</th>
<th>Tax</th>
<th>Address</th>
<th>Phone</th>
<th>Email</th>
<th>Products</th>
<th>Update</th>
<th>Delete</th>
</tr>
</thead>';
$query = "SELECT * FROM suppliers";
$result=mysqli_query($con,$query);
// $row=mysqli_fetch_array($result);
if (!$result) {
exit(mysqli_error());
}
// if query results contains rows then featch those rows
if(mysqli_num_rows($result) > 0)
{
$number = 1;
while($row = mysqli_fetch_array($result))
{
$data .= '<tr>
<td align="right"> '.$number.'</td>
<td align="center">'.$row['symbol'].'</td>
<td align="center">'.$row['companyname'].'</td>
<td align="center">'.$row['taxnumber'].'</td>
<td align="center">'.$row['address'].'</td>
<td align="center"> +'.$row['phone'].'</td>
<td align="center">'.$row['email'].'</td>
<td>
<button onclick="GetSupplierProducts('.$row['id'].')" class="btn btn-success text-center">All Products</button>
</td>
<td>
<button onclick="GetSupplierDetails('.$row['id'].')" class="btn btn-warning text-center">Update</button>
</td>
<td>
<button onclick="DeleteSupplier('.$row['id'].')" class="btn btn-danger text-center">Delete</button>
</td>
</tr>';
$number++;
}
}
else
{
// records now found
$data .= '<tr><td colspan="6">Records not found!</td></tr>';
}
$data .= '</table>';
echo $data;
?>
<script>
$(document).ready(function() {
$('#supplierTable').DataTable({
bJQueryUI: true,
sPaginationType: "full_numbers"
});
});
</script>
<script src="../bower_components/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="../bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script>
<script src="../dist/js/sb-admin-2.js"></script>
This is my code it displays the search bar and pagination at the middle. I would like them to be at the right. any ideas? Here is a picture:
I would simply love to see my search box under add a new supplier. thanks
Adding the three scripts at the end shows the search box, entries and pagination. well, I have the button in a main page:
<div class="pull-right">
<button class="btn btn-success" data-toggle="modal" data-target="#add_new_supplier_modal">Add A New Supplier</button>
</div>