doudian6229 2017-03-31 05:43
浏览 85
已采纳

致命错误:在null上调用成员函数prepare()

I'm getting this error and i can't find whats wrong.

I've read through the other posts about this error but none of them seemed to help.

Fatal error: Call to a member function prepare() on null on line 92

        <?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' => $min_lengd,
               'max_lengd' => $max_lengd,
                  'min_height' => $min_height,
                   'max_height' => $max_height,
                      'min_width' => $min_width,
                        'max_width' => $max_width, ];


  $stmt = $conn->prepare($sql);  // LINE 92
  $stmt->execute($params);


?>
  • 写回答

2条回答 默认 最新

  • drsc10888 2017-03-31 06:34
    关注

    It looks like your $conn variable is not initilazied. I can't see in the code you've uploaded where you are initializing it..

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?