Jump to content

multiple table query , please take a look!


dwex

Recommended Posts

I have 3 tables.

 

1. drama table                  dramaID    drama_title

                                              1              drama1

 

2. drama_genre table        drama_genreID    dramaID    genreID

                                              1                        1              2

                                              2                        1              1

 

3. genre table                      genreID    genre

                                                1            comedy

                                                2            romance


I wanna display in a way that for example,

 

Title          genre

 

drama1      comedy || romance

 


 

I tried "Select * from  "SELECT * FROM drama , genre , drama_genre WHERE drama.dramaID = drama_genre.dramaID AND genre.genreID = drama_genre.genreID";

 

<?php

    while($row=mysqli_fetch_assoc($result)){

         

        echo $row ['drama_title'];

        echo $row['genre'] ;

 

        }

    mysqli_close($link);

?>

 


Result was ..

 

Title          genre

 

drama1      comedy

 

drama1      romance

 

 

Please Help >.<

Link to comment
https://forums.phpfreaks.com/topic/209383-multiple-table-query-please-take-a-look/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.