[PHP-DB] Re: PHP/MySQL learning project
Hi. 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. You are thinking not in the terms of relational db. It's impossible on the mysql db level. WBR, Wicked -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: PHP/MySQL learning project
Alexey Kupershtokh wrote: Hi. 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. You are thinking not in the terms of relational db. It's impossible on the mysql db level. WBR, Wicked I don't know what you're trying to say here. You can do relational databases with mysql without any trouble whatsoever. Just because it doesn't support foreign keys (constraints) doesn't mean you can't have foreign keys. In fact, foreign keys mostly just slow down the run-time of your system, but I don't want to start a holy war here. -- paperCrane Justin Patrin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: PHP/MySQL learning project
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
[PHP-DB] Re: PHP/MySQL learning project
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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: PHP/MySQL learning project
Excellent! That's exactly what I needed to know! Thanks a million! Justin Patrin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php