Posted by josh on 04/12/07 05:01
I've been trying to learn some simple mysql and php commands by
replicating an html outline of my monthly bills using a mysql database
and php. Can anyone make suggestions about what I've done and what I
should do to complete this example? I would like to complete this and
know how others would do it since I'm sure there are much better ways.
To complete this, I just want to break up the results by months and
then do some math with the ones that are unpaid.
Thanks for any help. --Josh
Here is what I want it to look like:
http://www.brainbros.com/billspub.php
Here is the working page so far:
http://www.brainbros.com/select.php
Here is the basic code that created the above output of "select.php":
$query = "SELECT * FROM bills ORDER BY date_due DESC";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
if ($row['paid'] == "yes")
echo "<tr bgcolor='green'><td>".$row['name']."</td>".
"<td>$".$row['amount']."</td>".
"<td>".$row['date_due']."</td>".
"<td><div align='center'>".$row['paid']."</div></td>".
"<td>".$row['date_paid']."</td>".
"<td>".$row['account']."</td>".
"<td>".$row['date_bill']."</td></tr>";
else
echo "<tr bgcolor='red'><td>".$row['name']."</td>".
"<td>$".$row['amount']."</td>".
"<td>".$row['date_due']."</td>".
"<td><div align='center'>".$row['paid']."</div></td>".
"<td>".$row['date_paid']."</td>".
"<td>".$row['account']."</td>".
"<td>".$row['date_bill']."</td></tr>";
}
?>
Navigation:
[Reply to this message]
|