Help learning php/mysql

Help learning php/mysql

am 12.04.2007 07:01:14 von Josh

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 "".$row['name']."".
"$".$row['amount']."".
"".$row['date_due']."".
"

".$row['paid']."
".
"".$row['date_paid']."".
"".$row['account']."".
"".$row['date_bill']."";

else
echo "".$row['name']."".
"$".$row['amount']."".
"".$row['date_due']."".
"
".$row['paid']."
".
"".$row['date_paid']."".
"".$row['account']."".
"".$row['date_bill']."";

}
?>