0

Hi Dear all
Its my table structure...

CREATE TABLE IF NOT EXISTS `limsrentpayment` (
  `PaymentMonth` varchar(15) NOT NULL,
  `SiteID` varchar(15) NOT NULL,
  `DurationS` varchar(25) NOT NULL,
  `DurationE` varchar(25) NOT NULL,
  `Amount` varchar(15) NOT NULL,
  `pDate` date NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

and data stored in it

INSERT INTO `limsrentpayment` (`PaymentMonth`, `SiteID`, `DurationS`, `DurationE`, `Amount`, `pDate`) VALUES
('Dec-09', 'C-LHR-7300', '1-Dec-09', '30-Nov-10', '252,000.00', '2009-11-23'),
('Nov-09', 'C-ADP-5900', '8-Nov-09', '7-Nov-10', '152,769.00', '2009-11-12'),
('Nov-09', 'C-BAX-5825', '9-Nov-09', '8-Nov-10', '105,840.00', '2009-11-12');

another table is

CREATE TABLE IF NOT EXISTS `limscheaquesdispatched` (
  `SiteID` varchar(12) NOT NULL,
  `BaseAmount` varchar(25) NOT NULL,
  `cDate` date NOT NULL,
  `DurationSY` varchar(25) NOT NULL,
  `DurationEY` varchar(25) NOT NULL,
  `BatNo` varchar(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

and values are

INSERT INTO `limscheaquesdispatched` (`SiteID`, `BaseAmount`, `cDate`, `DurationSY`, `DurationEY`, `BatNo`) VALUES
('C-LHR-7300', '208,596.00', '2009-12-07', '09', '10', 'BAT364'),
('C-ADP-5900', '212,700.00', '2009-12-07', '09', '10', 'BAT364'),
('C-BAX-5825', '158,322.00', '2009-12-07', '09', '10', 'BAT364');

Now For one year I can easily show
Year, Due Date ,Date Sent To Finance, Date Returned From Finance, Date Resubmitted To Finance, Date Cheque Issued, Date Cheque Received by Owner, Payment Status

But I have to show it for more years.
Please check attached image.
I am confused.....!!!
For showing like this how I can store Data, i means structure of DB.

Attachments image.jpg 26.59 KB
2
Contributors
9
Replies
10
Views
7 Years
Discussion Span
Last Post by urtrivedi
0

Are you confused with report query or data structure?

I am confused about report .
I want to show record in table.

0

I want result like this...
Please also check Previous attached image for the reference.
I need a resullt in each cell from DB using different query.

Attachments image2.jpg 157.21 KB
0

select * from lease_tablen
while loop{}

If you have one table per cell, then this design is very poor.?
Even though you may execute query using two for loops

$rows=find number of year rows for particular user;
$cols=8; //year,due date, date sent etc
for ($rowindex=1;$rowindex<=$rows;$rowindex++)
{
 	print "<tr>";
	for ($colindex=1;$colindex<=$cols;$colindex++) 
	{
		$queryresult="select * from table".$rowindex*$colindex;// this will give appropriate table name for your cell
		//execute above query here
		print "<td>{$result}</td>";
	}
	print "</tr>";
}

above code is not syntatically correct.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.