Advertisement
Guest User

Flango

a guest
Oct 21st, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. <h3>Detalhes dos Filmes</h3>
  2. <hr>
  3. <table class="table table-bordered table-condensed">
  4. <thead>
  5. <tr>
  6. <th>Id</th>
  7. <th>Titulo</th>
  8. <th>Classificação</th>
  9. <th>Categoria</th>
  10. <th>Diretor</th>
  11. <th>Quantidade</th>
  12. <th>Status</th>
  13. </tr>
  14. </thead>
  15. <tbody>
  16. <?php
  17. $sql = mysql_query("SELECT * FROM filme ORDER BY Nome ASC");
  18. if (mysql_num_rows($sql) > 0) {
  19. while ($row = mysql_fetch_array($sql)) {
  20. //resgata o nome da categoria do filme
  21. $sql2 = mysql_query("SELECT Nome FROM categoria WHERE idCategoria='" . $row['Categoria_idCategoria'] . "'");
  22. $row2 = mysql_fetch_array($sql2);
  23.  
  24. $sql3 = mysql_query("SELECT Nome FROM diretor WHERE idDiretor='" . $row['Diretor_idDiretor'] . "'");
  25. $row3 = mysql_fetch_array($sql3);
  26.  
  27. //resgata quantos atores o filme possui
  28. $sql4 = mysql_query("SELECT COUNT(idAtor) as TotalAtores FROM ator_filme WHERE Filme_idFilme='" . $row['idFilme'] . "'");
  29. $row4 = mysql_fetch_array($sql4);
  30.  
  31. //resgata quantas legendas o filme possui
  32. $sql5 = mysql_query("SELECT COUNT(idLegenda_Filme) as TotalLegendas FROM legenda_filme WHERE Filme_idFilme='" . $row['idFilme'] . "'");
  33. $row5 = mysql_fetch_array($sql5);
  34.  
  35. //resgata quantos audios o filme possui
  36. $sql6 = mysql_query("SELECT COUNT(idAudio_Filme) as TotalAudios FROM audio_filme WHERE Filme_idFilme='" . $row['idFilme'] . "'");
  37. $row6 = mysql_fetch_array($sql6);
  38.  
  39.  
  40. echo '<tr>';
  41. echo '<td>' . $row['idFilme'] . '</td>';
  42. echo '<td>' . $row['Nome'] . '</td>';
  43. echo '<td>' . ($row['Classificacao'] == 0 ? 'livre' : $row['Classificacao']) . '</td>';
  44. echo '<td>' . $row2['Nome'] . '</td>';
  45. echo '<td>' . $row3['Nome'] . '</td>';
  46. echo '<td>' . $row['Qtde'] . '</td>';
  47. echo '<td>...</td>';
  48. echo '</tr>';
  49. }
  50. } else {
  51. echo '<tr>';
  52. echo '<td colspan="9">';
  53. echo 'Nenhum filme cadastrado!';
  54. echo '</td>';
  55. echo '</tr>';
  56. }
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement