Hi all.
I built an online finance tracking thingy for myself and I got it to work using the following database table and PHP code. I didn't write the PHP code, rather, I edited it to suit my needs.
It works great for my needs. I have a way to enter records and view the last 180 records in a table. The thing is, while viewing the table, I would lke to be able to edit and delete records. I don't know enough to be able to do this.
Can it be done? I realize my PHP code would probably, for the most part, be totally different.
Thanks for any help with this.
Here is my DB table structure:
DROP TABLE IF EXISTS `money`;
CREATE TABLE IF NOT EXISTS `money` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`date` date NOT NULL,
`type` varchar(18) NOT NULL,
`checking` decimal(5,2) NOT NULL DEFAULT '0.00',
`cash` decimal(5,2) NOT NULL DEFAULT '0.00',
`description` varchar(25) NOT NULL,
`who` varchar(25) NOT NULL,
`note` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
And here is the PHP:
<?php
$result = mysql_query ('SELECT date, type, checking, cash, who, description, note'
. ' FROM money'
. ' ORDER BY date DESC LIMIT 0,180')
or die(mysql_error());
echo "<table border='1' cellpadding='5'>";
echo "<tr><th>Date</th><th>Type</th><th>Checking</th><th>Cash</th><th>Who?</th><th>Description</th><th>Note</th></tr>";
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['date'];
echo "</td><td>";
echo $row['type'];
echo "</td><td>";
echo $row['checking'];
echo "</td><td>";
echo $row['cash'];
echo "</td><td>";
echo $row['who'];
echo "</td><td>";
echo $row['description'];
echo "</td><td>";
echo $row['note'];
echo "</td></tr>";
}
echo "</table>";
?>