Jump to content

[SOLVED] The first of records my query isnt showing up


newbreed65

Recommended Posts

Hey Everyone

 

I'm having a problem with the movie part of the page the link will take you too.

 

http://bulletsnoctane.co.uk/people/person.php?id=5

 

I'm trying to show all the movie that the person has been attached too but for some reason the first record in the query doesn't show

 

it should be

 

terminator salvation

dark knight

batman begins

 

not just the last 2 movies, I've double checked the query in phpmyadmin and all 3 records show up

 

<h3>Movies</h3>
<?php      

$sql = "SELECT *
       FROM casts JOIN movie 
   ON (casts.movie=movie.id)
   JOIN roles 
   ON (casts.role=roles.id)
   WHERE person_id=" . $id . "
   ORDER BY released DESC";
$result = mysql_query($sql) 
  or die(mysql_error());
$cast = mysql_fetch_array($result);

  if (mysql_num_rows($result) == 0) {
      echo "  <em>currently not attached to any movies</em>";
    	$table = "";
} else {

$table = "<table>";  
  while ($cast = mysql_fetch_array($result)) {

		$date1 = $cast['released'];
		$date2 = explode("-",date("Y-m-d",strtotime($date1)));//splits up the date

$table .= "<tr><td>" .
              $date2[0] . "</td>" .
		  '<td><a href="/movies/movie.php?id=' . $cast['movie'] . '">' .
              $cast['name'] . "</a></td><td>" .
              $cast['role_name'] . "</td><td>" .
              $cast['char_name'] . "</td>";
  }
}
  $table .= "</table>";

echo $table;
?>
</div>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.