Results 1 to 1 of 1

Thread: Query Result From One to Multiple Columns

  1. #1
    Join Date
    Aug 2010
    Location
    Brights Grove, Ontario
    Posts
    21

    Query Result From One to Multiple Columns

    PHP Code:

    $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.
    Last edited by Alan; 29 Sep 2010 at 12:53 PM. Reason: Added PHP BB code tags.

Similar Threads

  1. Simple SQL Select Query Question
    By MrQuestions in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 19 Mar 2008, 07:26 PM
  2. Are Selectable Columns Possible?
    By 7SeaS.Commander in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 05 Feb 2008, 02:21 PM
  3. Replies: 0
    Last Post: 27 Aug 2007, 05:51 AM
  4. Multiple AJAX requests
    By Luis in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 07 Mar 2006, 09:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •