title: INSERT or UPDATE using IF-ELSE php MYSQL
body: <pre><code>DONOR
  donor-nic----username-----status
  111----------ali----------available
  222---------usman--------notavailable
  </code></pre>
  
  <p>another is</p>
  
  <pre><code>DONATION
  donation_id------donor_nic-----date---
  1----------------111----------2012/03/04
  2---------------111-----------2012/06/07
  3----------------111---------2012/07/08
  4----------------222---------2012/03/03
  </code></pre>
  
  <p>now i want to update the date if it is already exits corresponding to donor_nic
  if date does not exists i want to insert that new date,.</p>
  
  <p>i am using this query to fetching all dates according to corresponding donor_nic</p>
  
  <pre><code>SELECT donor.donor_nic, donation.lastdonationdate
  FROM donor
  JOIN donation ON donor.donor_nic = donation.donor_nic
  WHERE username = 'ali'
  GROUP BY donation.lastdonationdate
  </code></pre>
  
  <p>now this query works in phpmyadmin.. but when i use this in my page.. it does not match date.. i am matching date like this</p>
  
  <pre><code>   $sql= SELECT donor.donor_nic, donation.lastdonationdate
      FROM donor
      JOIN donation ON donor.donor_nic = donation.donor_nic
      WHERE username = 'ali'
      GROUP BY donation.lastdonationdate
  
  $res=mysql_query($sql, $con);
  
  if($res == $date)
  {
  echo "update";
  }
  else
  {
  echo "insert";
  }
  </code></pre>
  
  <p>but this thing didnt work.. may be i am making mistake in conditional (if-else) statment..  plz help me what should i do..
  thanks in advance</p>