Re: PHP/MySQL learning project
| From: | news.php.net | Date: | Thu, 10 Jun 2004 22:51:06 +0000 |
| Subject: | Re: PHP/MySQL learning project | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-34728@lists.php.net to get a copy of this message | ||
Excellent! That's exactly what I needed to know! Thanks a million!
"Justin Patrin" <papercrane@reversefold.com> wrote in message
news:20040610220436.86094.qmail@pb1.pair.com...
> News.Php.Net wrote:
> > 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!
> >
> >
> >
>
> There's no way to do that in SQL alone. You should do it in PHP. :-)
>
> --
> paperCrane <Justin Patrin>