Check if Record Exists
<p>I found <a href="http://php.net/manual/en/function.file-exists.php" rel="nofollow">this on php.net</a> to check if file exists.</p>

<p>I want to check if record exists first, then do update, otherwise do an insert.</p>

<pre><code>if(record exist) {
   update query}
else 
  { insert query}
</code></pre>

<p>I know how to update or insert, but don't know how to check if a record exists first. How is it done?</p>
