PHP Help Please
Posted: Wed Mar 16, 2016 4:55 pm
Hello,
this is my code below is displays all my records on the page i was wondering if someone can help me please i have a field in mysql called payday it shows the date they are ment to pay me but if there late as paying i was it to display the records that have asap on not the one's with the dates can anyone help me please this is the code.
this is my code below is displays all my records on the page i was wondering if someone can help me please i have a field in mysql called payday it shows the date they are ment to pay me but if there late as paying i was it to display the records that have asap on not the one's with the dates can anyone help me please this is the code.
Code: Select all
<?php
session_start();
require("./styles/top.php"); ?>
<?php
if(!isset($_SESSION['session_user'])) {
echo("You must be logged in to view this page!.");
} else {
?>
<html>
<head>
<style>
table, td, th{
border: 1px solid black;
}
td {
padding: 5px;
}
</style>
<div id="full">
<body>
<p>Welcome, <?=$_SESSION['session_user']; ?> | <a href="logout.php">Logout</a> <br /> <br /> <button onclick="window.location.href='_add.php'">Add New Order</button> <button onclick="window.location.href='today.php'">Check If Money Is Due</button> <button onclick="window.location.href='asap.php'">Check All ASAP Money Due In</button></p><hr />
<table class="viewtable">
<tr>
<td>FULL NAME </td>
<td>PAY DATE</td>
<td>MONEY DUE</td>
<td id="toolbar">VIEW</td>
<td id="toolbar0">EDIT</td>
<td id="toolbar1">DELETE</td>
</tr>
<?php
error_reporting(0);
$sql = mysql_connect("", "", "") or die (mysql_error());
$select_db = mysql_select_db("", $sql);
$result = mysql_query("SELECT * FROM customers", $sql);
$totmoney = 0;
$strmoney = "";
while ($myrow = mysql_fetch_array($result))
{
$strmoney = $myrow["money"];
$strmoney = str_replace(',','',$strmoney);
if(is_numeric($strmoney))
{
settype($strmoney, "float");
$strmoney = number_format($strmoney, 2);
}
echo "<TR><TD><a href=\"_view.php?id=".$myrow['id']."\">".$myrow["name"]."</A> </TD><TD>".$myrow["paydate"]." </TD><TD>£".$strmoney." </TD>";
echo "<TD><a href=\"_view.php?id=".$myrow['id']."\"><img class=\"displayed\" alt=\"View\" src=\"images/view.png\" width=\"16\" height=\"16\" /></a></TD>";
echo "<TD><a href=\"_edit.php?id=".$myrow['id']."\"><img class=\"displayed\" alt=\"View\" src=\"images/edit.png\" width=\"16\" height=\"16\" /></a></TD>";
echo "<TD><a href=\"_delete.php?id=".$myrow['id']."\"><img class=\"displayed\" alt=\"View\" src=\"images/delete.png\" width=\"16\" height=\"16\" /></a></TD>";
echo "</TR>";
$totmoney = $totmoney + (int)$myrow["money"];
}
?>
<tr>
<td> </td>
<td></td>
<td></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>TOTAL MONEY DUE</td>
<td>£<?=number_format($totmoney, 2);?> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<br />
</body>
</head>
</html>
</div>
<?php
}
?>
<?php require("./styles/bottom.php"); ?>