我有 2 页 maincontent.php 和 showcontent.php。当有人访问 maincontent.php 时,他们会看到 2 个可以单击的图像。如果他们单击图像 1,则 showcontent.php 将获取有关该图像的更多信息并显示。这工作正常,但我希望能够从 2 个表中获取数据,而不仅仅是一个。
这是 maincontent.php
<?php include('includes/connect.php');?>
<div id="maincontent_holder">
<div id="newest_shows">
<?php
$query = "SELECT * FROM tv_shows ORDER BY id DESC LIMIT 6";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)) {
echo "<div id='lastest'>";
echo "<a href='show.php?show_name=$row[show_name]'><img src='$row[show_cover]' width='110' height='160' alt='$row[show_name]'> </a>";
echo "</div>";
}
?>
</div>
</div>
这是showcontent.php
<?php
include('includes/connect.php');
?>
<div id="maincontent_holder">
<?php
$show_name= $_GET['show_name'];
$sql1="SELECT * FROM tv_shows WHERE show_name = '$show_name'
UNION
SELECT * FROM show_episodes WHERE show_name = '$show_name'";
$result1=mysql_query($sql1);
while($row1 = mysql_fetch_assoc($result1)) {
echo "<div id='cover_img'>";
echo "<img src='$row1[show_cover]' width='110' height='160' alt='$row1[show_name]'>";
echo "</div>";
echo "<div id='show_title'>";
echo $row1['show_name'];
echo "</div>";
echo "<div id='show_info'>";
echo $row1['show_info'];
echo "</div>";
echo "<div id='show_airs'>";
echo $row1['show_airs'];
echo "</div>";
echo "<div id='show_status'>";
echo $row1['show_status'];
echo "</div>";
echo "<div id='show_top_adzone'>";
echo "</div>";
echo "<div id='show_desc'>";
echo $row1['show_desc'];
echo "</div>";
//end of show desc
echo "<div id='episode_list'>";
echo "<a href='blaa'>$row1[episode_name]</a>";
echo "</div>";
}
?>
</div>
这是我从 showcontent.php 得到的错误
警告:mysql_fetch_assoc() 期望参数 1 是资源,布尔值在第 15 行的 C:\xampp\htdocs\includes\layout\showcontent.php 中给出