title: Is there a way for PHP to validate an SQL syntax without executing it?
body: <p>I would like to build a PHP script that will validate an SQL query, but does not execute it. Not only should it validate syntax, but should, if possible, let you know if the query can be executed given the command that is in the query. Here's Pseudocode of what I would like it to do:</p>
  
  <pre><code>&lt;?php
  //connect user
  //connect to database
  //v_query = $_GET['usrinput'];
  if(validate v_query == true){
  echo "This query can be executed";
  }
  else{
  echo "This query can't be executed because the table does not exist.";
  }
  
  //disconnect 
  ?&gt;
  </code></pre>
  
  <p>Something like this. I want it to simulate the query without it executing it. That's what I want and I can't find anything on this.</p>
  
  <p>An example of why we wouldn't want the query to be executed is if the query adds something to a database. We just want it to simulate it without modifying the database.</p>
  
  <p>Any links or examples would be greatly appreciated!</p>