title: Get Current User ID from Mysql in php
body: <p>I create a Users Database and users have <code>username</code>, <code>password</code> etc. And each one has a unique <code>auto_increment</code> id. I need this; For example if I login to the website it should be <code>$id= my_id</code>, if you login to the website it should be <code>$id= your_id</code>. Can you help please. Thanks. </p>
  
  <p>I tried;</p>
  
  <pre><code>$result = mysql_query("select id from Users where username ='".$_SESSION['username']."'");
  </code></pre>
  
  <p><code>$row = mysql_fetch_array($result);</code></p>
  
  <pre><code>$id = $row['id']; 
  </code></pre>