SQLSTATE [HY000]:常规错误:25个绑定或列索引超出范围

时间:2013-12-09 02:42:16

标签: php database sqlite pdo

我已经坚持了几个小时。我一直收到此错误代码

  

SQLSTATE [HY000]:常规错误:25个绑定或列索引超出范围

尝试了我能找到的一切。

$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$stmt = $db->prepare('insert into rentals(title, pid, uid, address, description, amenities, manager_name, bedrooms, sale_price, property_type, manager_phone, manager_email)
values(:title, :pid, :uid,  :address, :description, :amenities, :manager_name, :bedrooms, :sale_price, :property_type, :manager_phone, :manager_email)');

        $stmt->bindParam(':title', $_POST['title']);
        echo $_POST['title'].'<br/>';
        $stmt->bindParam(':pid', $pid);
        echo $pid.'<br/>';
        $stmt->bindParam(':uid', $uid);
        echo$uid.'<br/>';


        $stmt->bindParam(':address', $_POST['street-address']);
        echo $_POST['street-address'].'<br/>';
        $stmt->bindParam(':description', $_POST['description']);
        echo $_POST['description'].'<br/>';
        $arr=   array($_POST['smoking'], $_POST['children'], $_POST['refridgerator'],
                $_POST['internet'], $_POST['utils'], $_POST['pool'], $_POST['laundry'],
                $_POST['microwave'], $_POST['stove'], $_POST['cable'], 
                $_POST['cleaning'], $_POST['ac']);
                $arr = array_filter($arr, 'strlen');
            $amenities = join(':|:', $arr);

        $stmt->bindParam(':amenities', $amenities);
        echo $amenities.'<br/>';
        $stmt->bindParam(':manager_name', $_POST['manager']);
        echo $_POST['manager'].'<br/>';
        $stmt->bindParam(':bedrooms', $_POST['bedrooms']);
        echo $_POST['bedrooms'].'<br/>';
        $stmt->bindParam(':sale_price', $_POST['prices']);
        echo $_POST['prices'].'</br>';   
        $stmt->bindParam(':property_type', $_POST['property_type']);
        echo $_POST['property_type'].'<br/>';
        $stmt->bindParam(':manager-phone', $_POST['manager-phone']);
        echo $_POST['manager-phone'].'<br/>';
        $stmt->bindParam('manager_email', $_POST['manager-email']);
        echo $_POST['manager-email'].'<br/>';

        $stmt->execute();
}catch(Exception $e){
    echo $e->getMessage();
}

unset($db);

0 个答案:

没有答案