title: PHP and Mysql not echoing my variable
body: <p>Not sure if I have coded this incorrectly or if it is just because I have a very large database that I am trying to pull from.</p>
  
  <p>I'm not receiving any errors but there is just nothing being displayed on the page. Is having a large database an issue which might prevent me from being able to find my result. I know that the postcode is within the database as I have found it in <code>PHPMYADMIN SQL</code> tab.</p>
  
  <pre><code>&lt;?php
  
  $location = $user['location'];
  
  $postcode = DB::query("SELECT * FROM postcodes WHERE Postcode LIKE '%" . $location . "%'");
  
  $longitude = $postcode['Longitude'];
  
  echo $longitude;
  
  ?&gt;
  </code></pre>
  
  <p>I'm getting the <code>$user['location']</code> from a query which is already loaded in and <code>echo</code>s on the page shows the postcode on the page already.</p>
  
  <p>I'm very new to <code>PHP</code> and <code>MYSQL</code> so am trying to learn but when it isn't giving me any errors it makes it very hard to search for what I am looking for.</p>
  
  <p>Thank you very much 
     - Jonny Dommett</p>
  
  <p>EDIT - Table Schema</p>
  
  <pre><code>id          int(11)         NO      PRI     NULL    auto_increment  
  Postcode    varchar(8)      NO              NULL        
  Latitude    decimal(9,6)    NO              NULL        
  Longitude   decimal(9,6)    NO              NULL        
  </code></pre>
  
  <p>EDIT - PDO </p>
  
  <pre><code>    &lt;?php
    class DB{
  
      private static function connect(){
        $pdo = new PDO('mysql:host=localhost;dbname=vapoural_wsc;charset=utf8','testing','testing123');
        $pdo-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        return $pdo;
  
      }
      public static function query($query, $params = array()){
        $statement = self::connect()-&gt;prepare($query);
        $statement-&gt;execute($params);
  
  
     if (explode(' ', $query)[0] == 'SELECT') {
    $data = $statement-&gt; fetchAll();
    return $data;
  }
  
      }
    }
  
   ?&gt;
  </code></pre>
  
  <p>EDIT - VAR DUMP</p>
  
  <pre><code>var_dump($postcode);
  </code></pre>
  
  <p>produced a result of </p>
  
  <p><code>array(0) { }</code></p>
  
  <p>EDIT - SQL WITHIN PHPMYADMIN</p>
  
  <p><a href="https://i.stack.imgur.com/KSejz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KSejz.png" alt="enter image description here"></a></p>
  
  <p>EDIT - The ISSUE = FIXED</p>
  
  <p>The Issue was from within my database on where I had entered my data. Make sure to check your columns by doing VARDUMP to see what that results first.</p>