title: SQL query not working but works in PHPMyAdmin
body: <p>I have a web application and I'm trying to modify one of the queries. The query fetches information (from a table named voyage_list) and returns various fields.</p>
  <p>I want to modify the query so that it is based on certain filters the user applies (which will be placed in the URL).</p>
  <p>I can't get the query to work in the web application, but if I copy the query and execute it directly within PHPMyAdmin, it works fine.</p>
  <pre><code>$vesselFilter = $_GET['vesselFilter'];
  $vesselArray = explode(',', $vesselFilter);
  
  $arrayCount = count($vesselArray);
  $sqlExtend = ' status = 1 AND';
  
  foreach ($vesselArray as $value) {
   $i = $i + 1;
   $sqlExtend .= &quot; vesselID = '$value'&quot;;
  
   if ($i &lt; $arrayCount){
    $sqlExtend .= &quot; OR&quot;;
   }
  }
  
  $newQuery = &quot;SELECT * FROM voyage_list WHERE&quot; . $sqlExtend;
  echo $newQuery;
  
  $query = $db-&gt;query($newQuery)-&gt;fetchAll();
  </code></pre>
  <p>I appreciate the above is pretty messy, but it's just so I can try and figure out how to get the query to work.</p>
  <p>Any help would be greatly appreciated!</p>
  <p>Thanks</p>