title: Get one value from mySQL database with PHP and save as variable
body: <p>I have a SQL database containing the columns <code>name</code> and <code>text</code>. How can I get only the <code>text</code> with the <code>name</code> and save that as a variable using PHP?</p>
  
  <p>I've tried several code snippets from other people but none worked.</p>
  
  <pre><code>$sql = "SELECT text FROM texts WHERE INSTR(name, '{$name}')";
  $result = $db-&gt;query($sql);
  $row = $result-&gt;fetch_assoc();
  $var=echo $row["name"];
  echo $var;
  </code></pre>