title: MYSQL WHERE clause in php
body: <p>I have a php file that display all artists that I have in my table, and its working fine. I am just trying to display particalar artists with specific condition, for example displaying only artists where their city is Baltimore. I am not good at php and would like to get some help. </p>
  
  <pre><code>&lt;?php 
      $page_title = 'Browse the Prints';
      include ('includes/browse_style.html');
      require ('../mydesigner/mysqli_connect.php');
      // Default query for this page:
      $q = "SELECT artists.artist_id, CONCAT_WS(' ', artist_name) AS artist, print_name, price, description, print_id FROM artists, prints WHERE artists.artist_id = prints.artist_id ORDER BY artists.artist_name ASC, prints.print_name ASC";
      // Are we looking at a particular artist?
      if (isset($_GET['aid']) &amp;&amp; filter_var($_GET['aid'], FILTER_VALIDATE_INT, array('min_range' =&gt; 1))  ) {
          // Overwrite the query:
          $q = "SELECT artists.artist_id, CONCAT_WS(' ', artist_name, artist_city, artist_type, artist_mobile) AS artist, print_name, price, description, print_id FROM artists, prints WHERE artists.artist_id=prints.artist_id AND prints.artist_id={$_GET['aid']} ORDER BY prints.print_name";
      }
  
      // Create the table head:
      echo "&lt;link rel='stylesheet' type='text/css' href='http://www.lectmohd.com/mydesigner/includes/css/table2.css' /&gt;"; 
      echo '&lt;table border="0" width="90%" cellspacing="3" cellpadding="3" align="center"&gt;
          &lt;tr&gt;
  
              &lt;th align="left" width="10%"&gt;السعر&lt;/b&gt;&lt;/th&gt;
              &lt;th align="right" width="40%"&gt;الوصف&lt;/th&gt;
              &lt;th align="right" width="20%"&gt;إسم التصميم&lt;/th&gt;
              &lt;th align="right" width="20%"&gt;المصمم&lt;/th&gt;
          &lt;/tr&gt;';
      // Display all the prints, linked to URLs:
      $r = mysqli_query ($dbc, $q);
      while ($row = mysqli_fetch_array ($r, MYSQLI_ASSOC)) {
  
          // Display each record:
          echo "\t&lt;tr&gt;
  
              &lt;td align=\"right\"&gt;\${$row['price']}&lt;/td&gt;
              &lt;td align=\"right\"&gt;{$row['description']}&lt;/td&gt;
              &lt;td align=\"right\"&gt;&lt;a href=\"view_print.php?pid={$row['print_id']}\"&gt;{$row['print_name']}&lt;/a&gt;&lt;/td&gt;
              &lt;td align=\"right\"&gt;&lt;a href=\"browse_prints.php?aid={$row['artist_id']}\"&gt;{$row['artist']}&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;\n";
  
      } // End of while loop.
  
      echo '&lt;/table&gt;';
      mysqli_close($dbc);
      include ('includes/footer.html');
  ?&gt;
  </code></pre>