0

我正在制作一个管理页面,管理员可以在其中为特定电影和特定剧院添加节目。管理员可以添加节目、剧院名称和电影名称。

这是一些代码..

<?php
$showdatetime=$_POST['showdatetime'];
$movieid=$_POST['movieid'];
$theaterid=$_POST['theaterid'];
if(empty($showdatetime)){  
echo  "Show time is a must";
}
else
{
$querycinema=mysql_query("SELECT show.show_datetime, show.theater_id, show.movie_id, theater.theater_name, movie.movie_name FROM `show` 
                        JOIN theater ON theater.theater_id = show.theater_id
                        JOIN movie ON movie.movie_id = show.movie_id                            
                        WHERE  show.show_datetime='$showdatetime' AND show.theater_id='$theaterid' AND show.movie_id='$movieid' ");
 $checkcinema=mysql_num_rows($querycinema);
if($checkcinema != 0)
{ 
echo "Sorry, ".$showdatetime." is already been scheduled for movie".$movieid." in theater ".$theaterid."."; 
}
else
{
 $insert_user=mysql_query("INSERT INTO `show` (show_datetime, movie_id, theater_id) VALUES ('$showdatetime','$movieid', '$theaterid')");

它工作正常,但我有一个问题

 echo "Sorry, ".$showdatetime." is already been scheduled for movie".$movieid." in theater ".$theaterid."."; }

我需要一种方法来为所选的剧院 ID 和电影 ID 添加电影名称和剧院名称 cz 最好向管理员显示名称而不是剧院和电影的 ID。

我希望很清楚..谢谢

4

2 回答 2

3

您已经在查询的结果集中有了电影名称,所以只需阅读它:

if($checkcinema != 0)
{ 
    $data = mysql_fetch_assoc($querycinema);
    echo "Sorry, ".$showdatetime." is already been scheduled for movie".$data['movie_name']." in theater ".$theaterid."."; 
}
于 2013-04-29T16:12:17.293 回答
0

只需像这样为您的数组添加价值$data['theather_name']&$data['movie_id']

于 2013-04-29T16:12:40.557 回答