title: How do write IF ELSE statement in a MySQL query
body: <p>How do I write an IF ELSE statement in a MySQL query? </p>
  
  <p>Something like this:</p>
  
  <pre><code>mysql_query("...(irrelevant code).. IF(action==2&amp;&amp;state==0){state=1}");
  </code></pre>
  
  <p>Then down in my array I should be able to do this:</p>
  
  <pre><code> $row['state'] 
  //this should equal 1, the query should not change anything in the database, 
  //just the variable for returning the information
  </code></pre>