title: Web Counter logical statement
body: <p>Pardon me by the way I will ask this question, I'm a newbie on this site.</p>
  
  <p>Im trying to record number of vistors who visited my website (web counter) <strong>erveryday</strong>!</p>
  
  <p>My logic is <code>if $date(realtime)</code> is equal to the $dateDB(max(adddate))`&lt;- (column in my database) then web counter will add 1...
  If not it will insert new data then add 1(IT MEANS ANOTHER DAY).</p>
  
  <pre><code>&lt;?php 
      $dateDB = mssql_query("select adddate = max(CONVERT(DateTime,CONVERT(VARCHAR(10),Adddate,101)))from tbl_web_counter");
          if($date == $dateDB){
              mssql_query("update tbl_web_counter SET webcounter_dealerview = webcounter_dealerview + 1 WHERE adddate = (SELECT max(adddate) FROM tbl_web_counter)");
          }else{
              mssql_query("insert into tbl_web_counter (webcounter_dealerView) values (1) ");
          }
      ?&gt;
  </code></pre>
  
  <p>The update function is running well, however If the statement is false (which is $date is not equal to $dateDB(max(adddate))</p>
  
  <p>"IT STILL UPDATING THE MAX(ADDDATE) NOT INSERTING NEW RECORDS"
  "<strong>IT MEANS THAT MY SYNTAX DID NOT PROCEED TO *<em>ELSE</strong>!</em>*"</p>
  
  <p>its is my syntax is wrong?</p>