title: Why are my SQLSRV queries not executing?
body: <p>Why are my SQLSRV queries not executing?</p>
  
  <p>It doesn't echo anything like its supposed to on the IF ELSE failure does anyone see what my issue is? I can't figure out whats wrong, it looks like it should be working to me.</p>
  
  <p>PHP Code:</p>
  
  <pre><code>/* IF NULL EXISTS of DATEIN or DATEOUT then UPDATE else INSERT*/
  $datein_s="SELECT TOP 1 datein FROM clocked WHERE datein IS NULL AND userid=? ORDER BY datein DESC";
  $datein_sr=sqlsrv_query($dbconnect,$datein_s,$params);
  $datein=sqlsrv_fetch($datein_sr);
  $datein_q1="UPDATE clocked SET datein=GETDATE() WHERE EXISTS(SELECT TOP 1 datein FROM clocked WHERE datein IS NULL AND userid=? ORDER BY datein DESC);";
  $datein_qr1=sqlsrv_query($dbconnect,$datein_q1,$params);
  $datein_q2="INSERT INTO clocked(datein) VALUES(GETDATE(),?);";
  $datein_qr2=sqlsrv_query($dbconnect,$datein_q2,$params);
  
  $dateout_s="SELECT TOP 1 dateout FROM clocked WHERE dateout IS NULL AND userid=? ORDER BY dateout DESC";
  $dateout_sr=sqlsrv_query($dbconnect,$dateout_s,$params);
  $dateout=sqlsrv_fetch($dateout_sr);
  $dateout_q1="UPDATE clocked SET dateout=GETDATE() WHERE EXISTS(SELECT TOP 1 dateout FROM clocked WHERE dateout IS NULL AND userid=? ORDER BY dateout DESC);";
  $dateout_qr1=sqlsrv_query($dbconnect,$dateout_q1,$params);
  
  if($datein===null)
  {
  $datein_qr1;
  }
  else if ($dateout===null)
  {
  $dateout_qr1;
  }
  else if ($datein===null&amp;&amp;$dateout===null)
  {
  $datein_qr1;
  }
  else if ($datein!==null&amp;&amp;$dateout!==null)
  {
  $datein_qr2;
  }
  else
  {
  echo "ERROR your query may be broken!";
  }
  
  /* END IF */
  </code></pre>