title: PHP PDO finding found rows of a UPDATE
body: <p>I have a small problem that I need help solving.
  Its more a lack in my MySQL knowledge then a problem really...</p>
  
  <p>I have a table of employes something like this:</p>
  
  <pre><code>CREATE TABLE employes (CoNo int, EmplCode int, Name varchar(250), Dep varchar(4))
  </code></pre>
  
  <p>It contains some data as such:</p>
  
  <pre><code>3 123 'John Jackson' 'INFO'
  3 124 'Simon Says'   'SELL'
  ...
  </code></pre>
  
  <p>I am trying to update Simons row using PHP PDO (something like):</p>
  
  <pre><code>$sql = "UPDATE employes SET CoNo = 3, Name = 'Simon Says', Dep = 'SELL' WHERE EmplCode = 124";
  $stmt = $PDOObject-&gt;prepare($sql);
  $status = $stmt-&gt;execute();
  echo $stmt-&gt;rowCount();
  </code></pre>
  
  <p>Now lets say everything is connecting and everything is working.
  If you paid attention during your MySQL classes you will soon see that this will echo 0 rows affected.</p>
  
  <p>Which apparently is a normal behavior for MySQL because the UPDATE didn't change anything to the actual data in the table.</p>
  
  <p>But what I need is a function just like rowCount() that will give me the FOUND rows not the AFFECTED rows or something that will let me force the update on the MySQL table.</p>
  
  <p>I have looked and googled the thing but I can't find anything and I am worried that it might be because it doesn't exist. </p>
  
  <p>I have heard of something called <code>FLAG_FOUND_ROWS</code> but I am not sure it is a PDO flag or how to use it (and I cant find anything on it).</p>
  
  <p>What I was hoping to achieve with this is something like a REPLACE statement or an UPSERT without the need of a primary key.</p>
  
  <p>If UPDATE return 0 rows then INSERT the row in the table.</p>
  
  <p><strong><em>EDIT</em></strong></p>
  
  <p>Sorry for the mistake I forgot the WHERE clause in the query. As pointed out in the comments.</p>
  
  <p><strong>EDIT</strong> </p>
  
  <p>I am still doing research on google for this and found a MySQL function called <code>FOUND_ROWS()</code> but It seems it need to be use in a separate query which doesn't really help since I could just do a SELECT beforehand. But this might give you guys an idea that I haven't think of yet. </p>
  
  <p>Thank you for all the help guys (and girls).</p>