title: Fatal error: Call to a member function prepare() on null
body: <p>I'm getting this error and i can't find whats wrong. </p>
  
  <p>I've read through the other posts about this error but none of them seemed to help.</p>
  
  <p><em>Fatal error: Call to a member function prepare() on null on line 92</em></p>
  
  <pre><code>        &lt;?php 
  
  
    include 'config.php';
  
  
     $lengd = $_POST["lengd"];
        $height = $_POST["height"];   
         $width = $_POST["width"];
  
  
  
       $min_lengd = $lengd * 0.9; $max_lengd = $lengd * 1.1;     
                $min_height = $height * 0.9; $max_height= $height * 1.1; 
                   $min_width = $width * 0.9; $max_width= $width * 1.1; 
  
  
  $sql = "SELECT lengd, height, width FROM filters;
  
        WHERE $lengd BETWEEN :min_lengd AND :max_lengd
  
          AND $height BETWEEN :min_height AND :max_height
  
              AND $width BETWEEN :min_width AND :max_width
  
               LIMIT 2";
  
              $params = [
              'min_lengd' =&gt; $min_lengd,
                 'max_lengd' =&gt; $max_lengd,
                    'min_height' =&gt; $min_height,
                     'max_height' =&gt; $max_height,
                        'min_width' =&gt; $min_width,
                          'max_width' =&gt; $max_width, ];
  
  
    $stmt = $conn-&gt;prepare($sql);  // LINE 92
    $stmt-&gt;execute($params);
  
  
  ?&gt;
  </code></pre>