title: PHP: How to select single value from single row in MySQL without using array for results
body: <p>I am new to PHP and have a really basic question. </p>
  
  <p>If I know the result of a query is only a single value (cell) from a single row in MySQL <strong>how can I simplify the below without having to go through an array of results</strong> and without increasing the risk of SQL injection ?</p>
  
  <p>In the example below I would just need to echo a single email as the result of the query. </p>
  
  <p>I found a couple of posts suggesting different approaches with <code>fetch_field</code> for this but I am not sure what is the best way here since some of these seem to be pretty old or deprecated now. </p>
  
  <p><strong>My PHP:</strong> </p>
  
  <pre><code>$stmt = $conn-&gt;prepare("SELECT email FROM Users WHERE userName = ? LIMIT 1");
  $stmt-&gt;bind_param('s', $userName);
  $stmt-&gt;execute();
  $result = $stmt-&gt;get_result();
  $arr = $result-&gt;fetch_assoc();
  echo $arr["email"];
  </code></pre>
  
  <p>Many thanks in advance.</p>