bradpotts
28 Sep 2010, 12:12 PM
$sql = 'SELECT AManufactureBrand.brand, AManufactureModel.model, AManufactureEdition.edition'
. ' FROM AManufactureModel'
. ' INNER JOIN AManufactureBrand ON AManufactureModel.brand_id = AManufactureBrand.brand_id'
. ' INNER JOIN AManufactureEdition ON AManufactureModel.model_id = AManufactureEdition.model_id'
. ' WHERE AManufactureEdition.edition=\'345i\'';
$resultSet = $database->query($sql);
// Begin building some HTML output
$html = '<table border="0">
<tr>
<th>carid</th>
</tr>';
while ($row = $resultSet->fetch_assoc())
{
$html .= '<tr><td>' . $row['brand'] . '</td></tr>';
$html .= '<tr><td>' . $row['model'] . '</td></tr>';
$html .= '<tr><td>' . $row['edition'] . '</td></tr>';
}
$html .= '</table>';
echo $html;
The Result of my Query and HTML output puts the editions BMW 3Series 345I into one column.
Like This:
BMW
3Series
345i
BMW
3Series
345i
How Can I get a Result Like This:
BMW BMW
3Series 3Series
345i 345i
This result is identical but the reason for this is because both editions have different options/price just working with a small sample.
. ' FROM AManufactureModel'
. ' INNER JOIN AManufactureBrand ON AManufactureModel.brand_id = AManufactureBrand.brand_id'
. ' INNER JOIN AManufactureEdition ON AManufactureModel.model_id = AManufactureEdition.model_id'
. ' WHERE AManufactureEdition.edition=\'345i\'';
$resultSet = $database->query($sql);
// Begin building some HTML output
$html = '<table border="0">
<tr>
<th>carid</th>
</tr>';
while ($row = $resultSet->fetch_assoc())
{
$html .= '<tr><td>' . $row['brand'] . '</td></tr>';
$html .= '<tr><td>' . $row['model'] . '</td></tr>';
$html .= '<tr><td>' . $row['edition'] . '</td></tr>';
}
$html .= '</table>';
echo $html;
The Result of my Query and HTML output puts the editions BMW 3Series 345I into one column.
Like This:
BMW
3Series
345i
BMW
3Series
345i
How Can I get a Result Like This:
BMW BMW
3Series 3Series
345i 345i
This result is identical but the reason for this is because both editions have different options/price just working with a small sample.