Hello

I was wondering if it is posible to show the user profile along with the products information let suppose if I had shown th the produtcs information can i show the information of the user who uploaded this prodcut.

$query2   = "SELECT * FROM users, products;
    $get_user = mysqli_query($connection, $query2);

    while ($row_user = mysqli_fetch_array($get_user)) { 
        echo "<div class='col-m'><h2 class='info-heading'>WATCH WORLD NYC</h2>";

        echo "<div class='prod-info'><div class='pbox-s'><span>ID:</span></div><div class='pbox-m'>". $row_user["u_id"] ;
        echo "</div><div class='clear'></div>";

        echo "<div class='pbox-s'><span>Name:</span></div><div class='pbox-m'>". $row_user["user_name"] ."</div><div class='clear'></div>";

        echo "<div class='pbox-s'><span>Phone:</span></div><div class='pbox-m'>". $row_user["phone"] ."</div><div class='clear'></div>";

        echo "<div class='pbox-s'><span>Fax:</span></div><div class='pbox-m'>". $row_user["fax"] ."</div><div class='clear'></div>";

        echo "<div class='pbox-s'><span>Mobile:</span></div><div class='pbox-m'>". $row_user["mobile"] ."</div><div class='clear'></div>";

        echo "<div class='pbox-s'><span>Email:</span></div><div class='pbox-m'>". $row_user["email"] ."</div><div class='clear'></div>";

        echo "<div class='pbox-s'><span>Location:</span></div><div class='pbox-m'>New York, NY</div><div class='clear'></div></div></div>";
    }   

products are already called this is the loop within the loop

please let me know if we can do this or not

Recommended Answers

All 3 Replies

Try googling for 'join query mysql'. Here is a link for referance http://www.w3schools.com/sql/sql_join.asp. Left join, right join, inner join etc all working for purpose. Normally I will decide which one to be used based on table structure for better performance.

Thank You all

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.