title: Unable to get Select2 to get data from my mysql database
body: <p>I've been trying a few different methods of getting Select2 to use information from my MySQL database. Currently, it seems something has been lost in translation and it's just showing the literal name of the <code>array(".$title")</code>. The database is called <code>vettigevrijdag</code> and the table is called <code>article</code>. </p>
  
  <p>My PHP snippet that is to be included in the navbar:</p>
  
  <pre><code>&lt;head&gt;
      &lt;link href="select2.css" rel="stylesheet"/&gt;
      &lt;script src="select2.js"&gt;&lt;/script&gt;
      &lt;script&gt;
        $(document).ready(function() {
        $('.js-example-basic-single').select2();
        });
      &lt;/script&gt;
      &lt;select class="js-example-basic-single"&gt;
      &lt;?php
        include('db.php');
        $stmt=$db_con-&gt;prepare("SELECT * FROM article");
        $stmt-&gt;execute();
        if($stmt-&gt;rowCount() &gt; 0){
          while($row=$stmt-&gt;fetch(PDO::FETCH_ASSOC))
          {
            extract($row);
            $id = $row['if'];
            $title = $row['title'];
          echo '&lt;option value="'.$id.'"&gt;'.$title.'&lt;/option&gt;';
          }
        }
      ?&gt;
      &lt;/select&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>My db.php file:</p>
  
  <pre><code>&lt;?php
  
  $dbhost = "localhost"; /* Host name */
  $dbname = "vettigevrijdag"; /* Database name */
  $dbuser = "localhost"; /* User */
  $dbpassword = "123456"; /* Password */
  
  
  try {
      $db_con = new PDO("mysql:host={$dbhost};dbname={$dbname}",$dbuser,$dbpassword);
      $db_con-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  
  } catch (PDOException $ex) {
      die($ex-&gt;getMessage());
      //throw $th;
  }
  ?&gt;
  </code></pre>