title: Fetching a single value from MySQL database in PHP
body: <p>I am trying to fetch a single value (the id) from a mysql database in PHP. I know this can be done in the following way:</p>
  
  <pre><code>$q = "SELECT * FROM users WHERE email ='" . $email . "'";
  $result = $conn-&gt;query($q);
  $row = $result-&gt;fetch_assoc();
  echo $row["id"];
  </code></pre>
  
  <p>However, I would think that I could speed up the query by instead of querying the entire row, I would only make a query for the id, which I would do like so:</p>
  
  <pre><code>$q = "SELECT 'id' FROM users WHERE email ='" . $email . "'";
  $result = $conn-&gt;query($q);
  $row = $result-&gt;fetch_assoc();
  echo $row["id"];
  </code></pre>
  
  <p>But for some reason, this returns the string "id", instead of the actual value. I have looked at a couple other similar questions, and the answers that I've tried from those gave the exact same result. </p>