Hi All, hopefully someone can lend me some insight with a problem I'm stuck with.
What I have is two tables.
TABLE: investmentOfferings
id: Unique identifier
class: Class of offering (A, or AA)
year: Year of offering
name: Friendly name of offering
units: Amount of units added in this offering
dollarPerUnit: Dollar value of one unit in this offering
warrant: Boolean for warrant or no (0=no 1=yes)
TABLE: actualInvestments
id: Unique identifier
investor: Identifies investor by referencing investors>id
dollarAmount: Dollar amount invested in this offering
class: Identifies class by referencing investmentOfferings>id
The structure of the application is so. investmentOfferings creates 4 fundraisers. Each year a new one. The actualInvestments table is the investment contributed per offering. Essentially what I need to do is to create a report, per investor(investors have a third separate table) that shows the amount invested per offering. The kicker being: not every investor will invest every offering, but I still needs to show a 0 dollar amount. I understand that I could create separate 0 dollar investments for each investor, but that seems impractical. Especially where there will be more offerings once I'm finished working on this. In terms of the report, here's what I'm doing to output the data to a table.
<?php do {?>
<tr>
<td><?php echo $row_offerings['name']?></td>
<td><?php echo $row_offerings['dollarAmount'];?></td>
<?php while ($row_offerings = mysql_fetch_assoc($offerings)); ?>
This creates a new column in the table for each part of my array. The issue I think is in my query.
"SELECT * FROM actualinvestments AS a RIGHT JOIN investmentofferings AS i ON i.id=a.offering WHERE class='AA' AND investor=" . $investorID . " OR investor IS NULL"
Ive tried variations on this, but cannot seem to find anything that will produce currently entered investments, and placeholders for offerings with no investments. Could anyone steer me in the right direction? Any help would be greatly appreciated.