help with inner join
Hello all,
I'm trying to learn something new, and I'm having a little bit of difficulty. I'm trying to learn about inner joins. I've looked at countless books, tutorials, and everything else I can find, but I can't seem to figure this out. Nothing I try works.
I've got tables that are related, and I'm trying to get the data to display. I've got the database set up as follows:
movies (name of table) has the fields movie_id, movie_name, and movie_star_rating
family_rating (name of table) has the fields star_id, star_name, and star_file_name
in PHPMyAdmin, I've got movies.movie_star_rating internally related to family_rating.star_id
When I display the data, I am trying to pull from the movies table, but instead of having a number displayed, I would like to have family_rating.star_name displayed. I've got the following code to do this:
$query="SELECT * FROM movies
INNER JOIN family_rating ON movies.movie_star_rating=family_rating.star_id
WHERE movies.movie_name_series='$search'";
$result= mysql_query($query)or die (mysql_error());
while($row=mysql_fetch_array($result)){
// Display the data
echo $row['movies.movie_name'];
echo $row['family_rating.star_file_name'];
}
Can anyone let me know what I'm doing wrong? Thanks for your help.
