Advertisement
chiabgigi

test1-query-actor

Oct 29th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.98 KB | None | 0 0
  1. #################################  query  ###################################
  2. select f.title, f.release_year, a.name, a.act_img
  3. from film f, actor a, film_actor r
  4. where a.actor_id = r.actor_id and r.film_id = f.film_id and a.actor_id = '1'
  5. #############################################################################
  6. <!DOCTYPE html>
  7. <html>
  8. <head>
  9.     <title>Test Modal</title>
  10.     <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
  11.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  12.     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  13. </head>
  14. <body>
  15.  
  16. <div class="row col-sm-8">
  17.     <table class="table">
  18.         <thead>
  19.         <tr>
  20.             <th scope="col">Title</th>
  21.             <th scope="col">Date</th>
  22.             <th scope="col">Poster</th>
  23.             <th scope="col">Name</th>
  24.             <th scope="col">Image</th>
  25.         </tr>
  26.         </thead>
  27.     </table>
  28. </div>
  29. <?php
  30. require 'chiabre_conn.php';
  31. $sql = "select f.title, f.release_year, f.image, a.name, a.act_img
  32. from film f, actor a, film_actor r
  33. where a.actor_id = r.actor_id and r.film_id = f.film_id and a.actor_id = '1'";
  34. $result = mysqli_query($conn, $sql);
  35. $data = [];
  36. if ($result){
  37.  while ($row = mysqli_fetch_array($result)){
  38.      $data[] = $row;
  39.      echo '
  40. <div class="row col-sm-8">
  41.    <table class="table">
  42.        <tbody>
  43.        <tr>
  44.            <td scope="row">'.$row['title'].'</td>
  45.            <td scope="row">'.$row['release_year'].'</td>
  46.            <td scope="row"><img src="movie_gallery/' . $row['image'] . '" height="50" width="40" class="img-thumnail" /></td>
  47.            <td scope="row">'.$row['name'].'</td>
  48.            <td scope="row"><img src="act_gallery/' . $row['act_img'] . '" height="50" width="40" class="img-thumnail" /></td>
  49.        </tr>
  50.        </tbody>
  51.        </table>
  52.        </div>
  53. ';
  54.  
  55.  }
  56. }
  57. return $data;
  58. ?>
  59. </body>
  60. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement