Help learning php/mysql

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>";

}
?>
Josh [ Do, 12 April 2007 07:01 ] [ ID #1685843 ]
PHP » alt.php.sql » Help learning php/mysql

Vorheriges Thema: The tables should start with capital letters SS but in local are small!
Nächstes Thema: CSV data to MySQL table (MyPHPAdmin)