title: PDO Lock Table Row INNODB
body: <p>I have a table where sensitive data is stored and need to take care, that only one session is able to read/write on a specific row. </p>
  
  <p>My table has 2 coloumns
  id (int) primary
  amount (int) index</p>
  
  <p>so I want to lock the table but only one row
  something like</p>
  
  <pre><code>LOCK TABLEROWS `mytable` WRITE WHERE `id` = 1
  </code></pre>
  
  <p>im using pdo and startTransaction wont prevent other sessions to read/write due that time</p>
  
  <p>i read the InnoDB Documentation but didnt get it to run</p>
  
  <p><strong>EDIT:</strong></p>
  
  <pre><code>$_PDO-&gt;exec('START TRANSACTION');
  $_PDO-&gt;query('SELECT * FROM `currency` WHERE `id` = '.$userid.' FOR UPDATE');  
  //maybe do update or not check if
  $_PDO-&gt;exec('COMMIT');
  </code></pre>
  
  <p>so thats all i need to do?</p>