title: PHP if/elseif logic with && and ||
body: <p>I have some php code for running a different mySQL queries based on an value sent from some HTML. The value sent from the HTML is the current day which I got using:</p>
  
  <pre><code>&lt;?php $day = date("w"); ?&gt;
  </code></pre>
  
  <p>When I use:</p>
  
  <pre><code>&lt;?php echo $day; ?&gt;
  </code></pre>
  
  <p>it returns 6, which is what it is supposed to do (because it is Saturday), so I can confirm that my HTML/php is sending the proper information to my script.</p>
  
  <p>Now in my script I have a big list of mySQL queries in if/elseif statments with both &amp;&amp; and || conditions.</p>
  
  <p>Here is an example of the first two ones:</p>
  
  <pre><code>if(($noshow == 1) &amp;&amp; ($day != 5 || $day != 6 || $day != 0)){
  $run = mysql_query("UPDATE employee_data SET points=points+5 WHERE ID=" . $id) or die(mysql_error());
  }
  elseif(($noshow == 1) &amp;&amp; ($day == 5 || $day == 6 || $day == 0)){
  $run = mysql_query("UPDATE employee_data SET points=points+7 WHERE ID=" . $id) or die(mysql_error());
  }
  </code></pre>
  
  <p>The variable $noshow is sent as well from my html file where it is in the form of a check box with a value of 1 (if checked). So what I need it to do is to run a query based on what day it is. In the first statement I want it to update points to equal the current points plus 5, if the box in the html is checked, and if it is not Friday, Saturday, or Sunday (5,6,0).</p>
  
  <p>The next statement is supposed to do the same thing as the first, but only if the day is Friday, Saturday, or Sunday. The script goes on with about 10 other statements for various check boxes/options that I have made.</p>
  
  <p>So the problem I am having, is that it is only running the first statement, even with the day being 6 (which I explained above) </p>
  
  <p>I have been going in circles for about two hours with this problem and it is driving my crazy. My current thought is that my syntax for the if statement isn't correct.</p>