如何顯示電影的評論?從與其他表格重合的表格中選擇數據
這是我的查詢 -
$query = "SELECT movies.movie_id, movies.movie_title,
FROM movies
INNER JOIN reviews
ON reviews.review_id=reviews.fk_movie_review";
CREATE TABLE IF NOT EXISTS `movies` (
`movie_id` int(4) NOT NULL AUTO_INCREMENT,
`movie_title` varchar(100) NOT NULL,
`actor` varchar(100) NOT NULL,
`fk_movie_ratings` int(2) NOT NULL,
PRIMARY KEY (`movie_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
INSERT INTO `movies` (`movie_id`, `movie_title`, `actor`, `fk_movie_ratings`) VALUES
(1, 'Batman Begins', 'Christian Bale', 5);
CREATE TABLE IF NOT EXISTS `ratings` (
`rating_id` int(2) NOT NULL,
`rating_name` varchar(50) NOT NULL,
PRIMARY KEY (`rating_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `ratings` (`rating_id`, `rating_name`) VALUES
(1, 'Excellent'),
(2, 'Brilliant'),
(3, 'Good'),
(4, 'Ok'),
(5, 'Terrible');
--
-- Table structure for table `reviews`
--
CREATE TABLE IF NOT EXISTS `reviews` (
`review_id` int(4) NOT NULL AUTO_INCREMENT,
`movie_review` mediumtext NOT NULL,
`fk_movie_review` int(4) NOT NULL,
PRIMARY KEY (`review_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
INSERT INTO `reviews` (`review_id`, `movie_review`, `fk_movie_review`) VALUES
(1, 'Wicked', 1);
什麼是真正的問題?如何顯示電影評論不是一個問題 - 我們不知道您正在努力的實際過程。 –
這是一個非常簡單的JOIN問題。你能告訴我們你到目前爲止所嘗試過的嗎? –