Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2016
    Posts
    14

    Unanswered: results from two tables problem

    Hi all, got a problem trying to retrieve data from another table. Clicking from a previous page i go to another which shoes information about a Supplier' from Suppliers table. There is another table called 'brands' which contains brands relating to all suppliers. the 'brands' table has a collumn called supplier_id. this is identicle to id of the supplier.

    I tried a LEFT JOIN but just returned an error, unless done something completely wrong. Can anyone help? Thanks in advance.

    PHP Code:
    <?php
    if(!empty($_GET['id']))
    {
    $sql "
    SELECT suppliers.name, suppliers.b2b, suppliers.contact, suppliers.errorlist
    FROM suppliers
    WHERE id = \"" 
    .(int)$_GET['id'] . "\"
    "
    ;

    }
    $results $con->query($sql);

    if(
    $results->num_rows) {
        While(
    $row $results->fetch_object()) {
            echo 
    "
        
        <div class='supplier-heading'>Supplier: <h3>
    {$row->name}</h3></div>
        <p><strong>B2B website:</strong> <a href='
    {$row->b2b}'>{$row->b2b}</a>
        <p><strong>Contact:</strong> 
    {$row->contact}</p>
        <p>Issues with epos or special notes.</p>
        <div class='brand-notes'><p>
    {$row->errorlist}</p></class>
                            
            
    "
    ;
        }
    } else {
        echo 
    'No Results';
    }
    ?>
    Last edited by TheTrooper; 01-30-16 at 09:44. Reason: wrong code was entered

  2. #2
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    what error? and where is the outer join you tried?
    Dave

Posting Permissions

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