<?php
/*
INDEX.PHP
Displays all data from 'account' table
*/
// connect to the database
include('connect-db.php');
// get results from database
$result = mysql_query("SELECT * FROM account")
or die(mysql_error());
// display data in table
// echo "<p><b>View All</b> | <a href='view-paginated.php?page=1'>View Paginated</a></p>";
echo "<div class='tbl-header'><table cellpadding='0' cellspacing='0' border='0'>";
echo "<tr><th width=10% style=text-align:center><input type='text' id='myInput0' onkeyup='myFunction0()' placeholder='Search' onclick='myFunctionC()'>
<th width=10% style=text-align:center><input type='text' id='myInput1' onkeyup='myFunction1()' placeholder='Search' onclick='myFunctionC()'>
<th width=20%><input type='text' id='myInput2' onkeyup='myFunction2()' placeholder='Search' onclick='myFunctionC()'>
<th width=10%><input type='text' id='myInput3' onkeyup='myFunction3()' placeholder='Search' onclick='myFunctionC()'>
<th width=5% style=text-align:center><a href='index.php'>reset</a><th width=5%><tr>";
// close table>
echo "</div></table>";
echo " <div class='tbl-content'><table id='myTable' cellpadding='0' cellspacing='0' border='0'>";
echo "<tr><th width=10% style=text-align:center onclick='sortTable(0)' scope='row'>dateAndTime
<th width=10% style=text-align:center onclick='sortTable(1)'>category<th width=20%>content<th width=10%>sum
<th width=5%><th width=5%><tr>";
while($row = mysql_fetch_array( $result ))
{
// echo out the contents of each row into a table
// echo '<td>' . $row['id'] . '</td>';
echo '<td style=text-align:center>' . $row['dateAndTime'] . '</td>';
echo '<td style=text-align:center>' . $row['category'] . '</td>';
echo '<td>' . $row['content'] . '</td>';
echo '<td>' . $row['sum'] . '</td>';
echo '<td style=text-align:center><a href="edit.php?id=' . $row['id'] . '">Edit</a></td>';
echo '<td style=text-align:center><a href="delete.php?id=' . $row['id'] . '">Delete</a></td>';
echo "</tr>";
}
// close table>
echo "</table></div>";echo $_SERVER['SERVER_ADDR'];
?>