akabod Posted November 13, 2010 Share Posted November 13, 2010 I'm trying to write a php page that displays data from a JOIN query for a specific ID table view brandinfo ID, brand, discounttype 1, antioni, no discount brandproducts brandID, producttype, price 1, Tshirt, 20.00 1, Pants, 30.00 1, Shoe, 40.00 the returned result is 1 antioni, no discount, Tshirt, 20.00, 2 antioni, no discount, Pants, 30.00 3 antioni, no discount, Shoe 40.00 The way I want the page to be displayed is ------------------ Antioni (at the top) Table 1. Tshirt 20.00 2. Pants 30.00 3. Shoe 40.00 no discount (at the bottom) ---------------------------- How should I construct the PHP page from the result since they're retrieved as rows? Quote Link to comment Share on other sites More sharing options...
possien Posted November 13, 2010 Share Posted November 13, 2010 It may not be the best way but I recently did something similar by nesting while statements from 3 queries: while($row = mysqli_fetch_array($name)){ //Display name while($row = mysqli_fetch_array($data)){ //display data while($row = mysqli_fetch_array($discount)){ // display discount Quote Link to comment Share on other sites More sharing options...
akabod Posted November 13, 2010 Author Share Posted November 13, 2010 It may not be the best way but I recently did something similar by nesting while statements from 3 queries: while($row = mysqli_fetch_array($name)){ //Display name while($row = mysqli_fetch_array($data)){ //display data while($row = mysqli_fetch_array($discount)){ // display discount Thanks! That's exactly what I'm looking for. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.