|
Posted by Rincewind on 10/13/98 11:28
I have a page that outputs data about a tv show, all is working fine,
however when a query returns for example 14 results I want to be able to
output the number that corresponds to the position in the result, alongside
the details.
I can build a loop using mysql_num_rows to count the rows, but I don't know
how to incorporate it within the while loop that is running to retrieve the
actors details.
Can anyone help please.
code follows:
<?php
// open the connection
$conn = mysql_connect("localhost", "user", "password");
// pick the database to use
mysql_select_db("DB_name",$conn);
$epid = $_REQUEST['id'];
//query mysql
$result = mysql_query( "SELECT * FROM actor a
INNER JOIN episode_cast e on e.id = a.id
INNER JOIN episode f on f.episode_number = e.episode_number
WHERE e.episode_number = $epid");
echo mysql_error();
// creates the page
while($row = mysql_fetch_array($result, MYSQL_BOTH))
{
list($id, $character_first_name, $character_last_name,
$character_full_name, $character_height_feet, $character_height_inches,
$character_weight, $character_color_eyes, $character_color_hair,
$character_bio, $actor_first_name, $actor_last_name, $actor_full_name,
$actor_height_feet, $actor_height_inches, $actor_birthdate,
$actor_birth_place, $actor_maraital_status, $actor_film, $actor_tv,
$actor_bio, $picture, $episode_number, $id, $episode_number1, $season,
$season_episode_number, $episode_name, $episode_outline) = $row;
$content .= "<div class=\"character\">
<h3><span>*This is where I want the Number*</span>
$character_first_name $character_last_name</h3>
<a href=\"$picture\"><img src=\"$picture\" alt=\"$actor_first_name
$actor_last_name\" /></a>
<ul>
<li>Full name: <span>$character_full_name</span></li>
<li>Height:
<span>$character_height_feet$character_height_inches</span></li>
<li>Weight: <span>$character_weight</span></li>
<li>Eyes: <span>$character_color_eyes</span></li>
<li>Hair: <span>$character_color_hair</span></li>
</ul>
<p>$character_bio</p>
<ul>
<li>Actor: <span>$actor_full_name</span></li>
<li>Height:
<span>$actor_height_feet$actor_height_inches</span></li>
<li>Birthdate: <span>$actor_birthdate
$actor_birth_place</span></li>
<li>Marital Status: <span>$actor_maraital_status</span></li>
<li>Filmography: <span>$actor_film</span></li>
<li>TV: <span>$actor_tv</span></li>
</ul>
<p>$actor_bio</p>
</div>";
}
$content = stripslashes($content);
echo mysql_error();
mysql_close($conn);
include 'library/header.php';
?>
<div id="episode_head"> <h2>
<?php echo $episode_name; ?>
</h2><h3>
<span>#<?php echo $season. " - ";
echo $season_episode_number; ?></span>
</h3>
</div>
<?php
echo $content;
include'library/footer.php' ;
?>
Navigation:
[Reply to this message]
|