I’ve got a php page that list videos in an array pulled from a database (movies.php) each array has a button that says “Full Summary”. That button needs to link to my Summary page (summary.php) i am having issues with passing the info to the playing page and getting it to display properly.
any help with my code would be greatly appreciated
movies.php:
<?php
if ($_GET['sort'] == "action"){
$sql = "SELECT *
FROM Movies
WHERE genre LIKE 'Action'
ORDER BY title
ASC, title";
}
if ($_GET['sort'] == "adventure"){
$sql = "SELECT *
FROM Movies
WHERE genre LIKE 'Adventure'
ORDER BY title
ASC, title";
}
if ($_GET['sort'] == "animation"){
$sql = "SELECT *
FROM Movies
WHERE genre LIKE 'Animation'
ORDER BY title
ASC, title";
}
if ($_GET['sort'] == "comedy"){
$sql = "SELECT *
FROM Movies
WHERE genre LIKE 'Comedy'
ORDER BY title
ASC, title";
}
$id = $_GET['id'];
$movieid = $row['id'];
$type = $_GET['type'];
$result = mysql_query($sql);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
}
if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
}
while($row = mysql_fetch_array($result)){
echo "<br />";
echo "<table width='98%' border='0' cell='2'>";
echo "<tr>";
echo "<td bgcolor='#0097FF' <span class=\"style5\">";
echo $row['title'];//." ". $row ['date']. " : " . " ".$row['time'];
echo "</td>";
echo "<td bgcolor='#0097FF' <span class=\"style5\">";
echo "<div align='right'>";
echo $row ['year'];
echo "</div>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td valign='top' <span class=\"style5\">";
echo $row['short_summary'];
echo "<br />";
echo "<br />";
echo "<a href= summary.php?id=".$row['id'].">";
echo "Full Summary";
echo"</a>";
echo "<br />";
echo "<br />";
echo "<a href= 'playing.php'>";
echo "Play This Movie";
echo "</a>";
echo "</span>";
echo "</td>";
echo "<td>";
if ($row['cover_art'] <> ""){
$display_img = "cover_art/".$row['cover_art'];
$size = getimagesize("$display_img");
$height = $size[1];
$width = $size[0];
if ($width > 200)
{
$width = 200;
$percent = ($size[0] / $width);
$height = ($size[1] / $percent);
}
if ($row['cover_art'] <> ""){
$img_path = "cover_art/".$row['cover_art'];
echo "<img src=$img_path height=\"$height\" width=\"$width\" >";
}
}
echo "</td>";
echo "</tr>";
echo "</table>";
}
?>
summary.php:
<?php
$result = mysql_query("SELECT * FROM Movies WHERE 'id' = $id");
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
while($row = mysql_fetch_array($result)){
echo "<br />";
echo "<table width='98%' border='0' cell='2'>";
echo "<tr>";
echo "<td bgcolor='#0097FF' <span class=\"style5\">";
echo $row['title'];//." ". $row ['date']. " : " . " ".$row['time'];
echo "</td>";
echo "<td bgcolor='#0097FF' <span class=\"style5\">";
echo "<div align='right'>";
echo $row ['year'];
echo "</div>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td valign='top' <span class=\"style5\">";
echo $row['long_summary'];
echo "<br />";
echo "<br />";
echo "<a href= {$row['movie_hi']}>";
echo "Play This Movie";
echo "</a>";
echo "</span>";
echo "</td>";
echo "<td>";
if ($row['cover_art'] <> ""){
$display_img = "cover_art/".$row['cover_art'];
$size = getimagesize("$display_img");
$height = $size[1];
$width = $size[0];
if ($width > 200)
{
$width = 200;
$percent = ($size[0] / $width);
$height = ($size[1] / $percent);
}
if ($row['cover_art'] <> ""){
$img_path = "cover_art/".$row['cover_art'];
echo "<img src=$img_path height=\"$height\" width=\"$width\" >";
}
}
echo "</td>";
echo "</tr>";
echo "</table>";
}
?>