好的,我将解释我正在做一个电影在线预订系统...用户可以选择电影->电影院->要预订的放映我已经到达放映页面
这是查找特定电影和电影院节目的代码:
<?php
require('classes/show_class.php');
$show=new show($_GET["cinema_id"]); //CAN I MAKE 2 GETS LIKE THIS?? MAYBE THIS
$show=new show($_GET["movie_id"]); // IS THE ERROR
$showcinemas = $show->get_show_cinemas();
echo '<table border="1">';
echo '<tr><td align="center"><b>CINEMA<b></td></tr>';
foreach ($showcinemas as $show)
{
$show_id = $show['show_id'];
$show_datetime = $show['show_datetime'];
$cinema_id = $show['cinema_id'];
$movie_id = $show['movie_id'];
echo '<tr>';
echo '<td>';
echo "<a href='show_theater.php?cinema_id={$cinema_id}&movie_id={$movie_id}&show_id={$show_id}'>" . $show_datetime . '</a>';
echo '</td>';
echo '</tr>';
}
echo '</table>';
?>
此页面的输出是:CINEMA 2013-03-03 14:00:00 <-- 这是cinema_id=1&movie_id=1&show_id=1 虽然我使用过movie_id=2&cinema_id=5
我希望我现在说清楚了……谢谢你
这是 show_class.php
public function __construct()
{
$query = mysql_query(
"SELECT *
FROM movie, cinema
"
);
$results = mysql_fetch_assoc($query);
$this->movie_id = $results['movie_id'];
$this->movie_name = $results['movie_name'];
$this->movie_category = $results['movie_category'];
$this->cinema_id = $results['cinema_id'];
$this->cinema_name = $results['cinema_name'];
}
public function get_show_cinemas()
{
$query = mysql_query(
"SELECT show.show_datetime, show.show_id, cinema.cinema_id, movie.movie_id
FROM `cinema`
JOIN `theater` ON `theater`.`cinema_id` = `cinema`.`cinema_id`
JOIN `show` ON `show`.`theater_id` = `theater`.`theater_id`
JOIN `movie` ON `movie`.`movie_id` = `show`.`movie_id`
WHERE `cinema`.`cinema_id` = {$this->cinema_id} AND `movie`.`movie_id` = {$this->movie_id} "
);
while( $cinema = mysql_fetch_assoc( $query ) )
{
$results[] = $cinema;
}
return $results;
}