title: Query Structure: SELECT FROM places WHERE Type = 1
body: <p>Okay so i am trying to display all entries in one of my database tables where the field 'Type' has a value of 1 but i keep getting an error. I'm not sure how to structure my query.</p>
  
  <pre><code>&lt;?php
  include 'page-start.php';
  ?&gt;
  &lt;?php
  $myQuery  = "SELECT places.*, Type.TypeName ";
  $myQuery .= "FROM places ";
  $myQuery .= "WHERE Type = '1' ";
  $myQuery .= "INNER JOIN Type ON places.Type = Type.TypeID";
  
  $result = $con-&gt;query($myQuery);
  if (!$result) die('Query error: ' . mysqli_error($result));
  ?&gt;
  
  
  
   &lt;?php
  
              while($row = mysqli_fetch_array($result))
              {
  
      echo ' &lt;div class="one-third column" id="education"&gt;';
      echo '&lt;h3 class="place-head"&gt;&lt;a href="educationdetails.php?ID=' . $row['PlaceID'] . '"&gt;' . $row['PlaceName'] . '&lt;/a&gt;&lt;/h3&gt;';
      echo    ' &lt;div class="a-image"&gt;';
      echo        '&lt;img src="'. $row['ImageURL'] . '"/&gt;';
      echo    ' &lt;/div&gt;';
      echo        ' &lt;div class="a-info"&gt;';
  
  
      echo        ' &lt;/div&gt;';
      echo    '&lt;/div&gt;';   
              }
  
      ?&gt;
  </code></pre>
  
  <p>After playing around i managed to get it working by executing the query on its own underneath the first query like this:</p>
  
  <pre><code>&lt;?php
  $myQuery  = "SELECT places.*, Type.TypeName ";
  $myQuery .= "FROM places ";
  $myQuery .= "INNER JOIN Type ON places.TypeID = Type.TypeID";
  
  $result = $con-&gt;query($myQuery);
  if (!$result) die('Query error: ' . mysqli_error($result));
  ?&gt;
  &lt;?php
  $myQuery = "SELECT * FROM `places` WHERE `TypeID` = '1'";
  $result = $con-&gt;query($myQuery);
  if (!$result) die('Query error: ' . mysqli_error($result));
  ?&gt;
  </code></pre>
  
  <p>I don't know if this was the correct way of getting round my problem but it works. Thanks for the help anyway guys.</p>