title: php - sql select "where" equals to a couple of variables?
body: <p>I am parsing 3 variables from JSON link, each of variable consist of the name of a cinema theater:</p>
  
  <pre><code>$cinema1
  $cinema2
  $cinema3
  </code></pre>
  
  <p>After, I need to select an ids of all 3 cinemas from the table, then using that ids I need to look for the table "movietimings" to see if there is movies are playing today, if there is a movie playing in that cinemas today, then I need to go for "movie" table and show all information about that movie. </p>
  
  <p>So, this is what have been accomplished:</p>
  
  <pre><code>    $sql2 = "SELECT DISTINCT * FROM cinema WHERE cinemaname = '$cinema1' AND cinemaname='$cinema2' AND cinemaname='$cinema3' ";
  
      $result2 = $conn-&gt;query($sql2);
  
      if ($result2-&gt;num_rows &gt; 0) {
          // output data of each row
          while($row2 = $result2-&gt;fetch_assoc()) {
  $cinemaid2 = $row2['id'];// I have received a cinema id
  
  
  
  
  //getting the main id, since the id I just got is a branch of the main cinema, so the main id that is associated with movie timings is down below
  $sql5 = "SELECT DISTINCT * FROM cinemas WHERE cinemaname = '$cinemaid2'";
  
  $result5 = $conn-&gt;query($sql5);
  
  if ($result5-&gt;num_rows &gt; 0) {
      // output data of each row
      while($row5 = $result5-&gt;fetch_assoc()) {
  
  $cinemaid = $row5['id'];//received main id required
  
  $today = date("m/d/Y");//getting todays date
  
  //now trying to find if a movie today playing
  $sql3 = "SELECT  * FROM moviecinemashowsassociation WHERE cinemaid LIKE '$cinemaid' AND showdate LIKE '$today'";
  
  $result3 = $conn-&gt;query($sql3);
  
  if ($result3-&gt;num_rows &gt; 0) {
      // output data of each row
      while($row3 = $result3-&gt;fetch_assoc()) {
  $movieid = $row3['movieid'];// selected a movie id played today
  
  //selecting information about movie
  $sql4 = "SELECT  * FROM movie WHERE id='$movieid'";
  
  $result4 = $conn-&gt;query($sql4);
  
  if ($result4-&gt;num_rows &gt; 0) {
      // output data of each row
      while($row4 = $result4-&gt;fetch_assoc()) {
  </code></pre>
  
  <p>The problem is that I have 3 different cinemas which should go through one loop. </p>