Re: PHP/MySQL learning project

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So given the same database diagram ("MovieMain", "Actors", "Genre", then a
table named "MovieActor" to allow multiple actors to be associated with a
movie, and "MovieGenre" to allow multiple genre's to be associated with a
movie), can you steer me in the right direction on writnig the PHP to
display all movies (one by one) with all of the actors and genre's
associated with each movie (yet only display the movie title once)?

<thanks a million!>

"News.Php.Net"
> Hi everyone!
>
> In trying to learn PHP and MySQL, I'm trying to create a web-based
database
> application that will keep track of my movies.  I have five tables (shown
in
> the graphic).  I'm trying to be able to display the results of the tables
> with one movie title, all of the actors associated with it, and all of the
> genre's associated with it.
>
> Of course I can do the query:
>   Select *
>   From MovieMain, MovieActor, MovieGenre, Genre, Actors
>   Where MovieMain.MovieID=MovieGenre.MovieID
>   And MovieMain.MovieID=MovieActor.MovieID
>   And MovieActor.ActorID=Actors.ActorID
>   And MovieGenre.GenreID=Genre.GenreID
>
> But that displays the movie title for every genre and actor there is.  Is
> there another way to perform the query that will display the title once,
and
> all of the associated genres and all of the associated actors for that
> movie?  Or should I try to code it using PHP to find the movie title
first?
>
> Thanks in advance, everyone!
>
>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux