View Single Post
Old 11-27-2012, 10:33 PM   PM User | #6
Thyrosis
New Coder

 
Join Date: Nov 2012
Posts: 72
Thanks: 4
Thanked 11 Times in 11 Posts
Thyrosis is on a distinguished road
Right, I've put something together. I don't know if it does what you want, but it outputs a table of 3 columns (merchants, issues and updates) and should output roughly thesame as you have in your picture.

PHP Code:
// Set merchant, issue and update value to blank.
$merchant "";
$issue "";
$update "";

// Start display
$display "<table>
                <tr>
                    <th>Merchants</th>
                    <th>Issues</th>
                    <th>Updates</th>
                </tr>"
;

// Loop through all the results in the MySQLi $result set. You'll obviously have to
// load it with $result = $mysqli->query($sql) or something first.
while($r $result->fetch_array()) {
    
// Start each result on a new row
    
$display .= "<tr>";
    
    
// If the merchant name is not thesame as the last one,
    // set $merchant to this merchant name and fill cell with 
    // name and other details. Otherwise, just echo empty cell.
    
if($r['merchant_name'] != $merchant) {
        
$merchant $r['merchant_name'];
        
$display .= "<td>$r['merchant_name']<br />$r['merchant_phone']</td>";
    } else {
        
$display .= "<td>&nbsp;</td>";
    }
    
// If the issue name is not thesame as the last one,
    // set $issue to this issues name and fill cell with 
    // name. Otherwise, just echo empty cell.
    
if($r['issue_name'] != $issue) {
        
$issue $r['issue_name'];
        
$display .= "<td>&nbsp;</td><td>$r['issue_name']</td>";
    } else {
        
$display .= "<td>&nbsp;</td>";
    }
    
    
// Update is always displayed in each row if exists.
    
$display .= "<td>$r['update_name']</td></tr>";
}

$display .= "</table>"
Hope it's a bit of help

Regards,
Martin

Last edited by Thyrosis; 11-27-2012 at 10:35 PM.. Reason: added comment
Thyrosis is offline   Reply With Quote
Users who have thanked Thyrosis for this post:
Subyne Simean (11-30-2012)