I am attempting to create an expense tracking program. I created a table:
CREATE TABLE exp7 (
EXPDATE date DEFAULT '0000-00-00' NOT NULL,
CHECKNO int(10) NOT NULL auto_increment,
ACCNO varchar(50) DEFAULT '0' NOT NULL,
FOLNO varchar(50) DEFAULT '0' NOT NULL,
PAYTO varchar(50) DEFAULT '0' NOT NULL,
AMOUNT float(8,2) DEFAULT '0.00' NOT NULL,
EMEMO varchar(30) NOT NULL,
ARCHIVE char(1) DEFAULT 'N' NOT NULL,
PAIDBY char(1) DEFAULT '0' NOT NULL,
PRIMARY KEY (CHECKNO)
);
I am interseted in creating a page that displays all the payees (PAYTO)and the amount (AMOUNT) paid for each account (ACCNO). I also want to "do the math" so I can display the totals for each account (ACCNO)as well as the Total Expenditures.
e.g. http://triponline.com/tax/report.htm
Perscriptions 35.00
Bill's Pharmacy 20.00
K-Mart Pharmacy 15.00
I have tried to nest two while loops with no luck.
Here is a stab at my most recent attempt. I know it is wrong and I think I know how it should go but I need help! Once I get the hang of this loops A lot of ideas will come out of the closet upon which I can practice.
$sql = "select * from $table order by ACCNO desc";
$result = @($sql, $hookup) or die("Couldn't Execute Query!");
while ($row = mysql_fetch_array($result)) {
$ACCNO = $row['ACCNO'];
$PAYTO = $row['PAYTO'];
$ac = "$ACCNO";
echo "<BR>$ACCNO";
While ($ACCNO = $ac){
echo "<BR>$PAYTO";
}
}