为什么我的php 5.6而不是5.3会出现致命错误?

时间:2017-02-03 17:57:56

标签: php mysql pdo

我刚刚将我的服务器从php 5.3更新到php 5.6,现在由于某种原因我不再使用的网页了。它抛出了这个错误:

Fatal error: Call to undefined method PDOStatement::bind_param()

我无法弄清楚我的错误。我真的很感激任何帮助。

php(不是全部)

include("connect.php"); //include config file
session_start(); // start up your PHP session! 

//sanitize post value
$page_number = filter_var($_POST["page"], FILTER_SANITIZE_NUMBER_INT, FILTER_FLAG_STRIP_HIGH);

//throw HTTP error if page number is not valid
if(!is_numeric($page_number)){
    header('HTTP/1.1 500 Invalid page number!');
    exit();
}

//get current starting point of records
$position = (($page_number-1) * $item_per_page);

//fetch records using page position and item per page. 
$results = $conn->prepare("SELECT up.id, up.file, up.title, p.user_name, p.user_id, GROUP_CONCAT(CONCAT(cp.user_id, '~', cp.user_name) SEPARATOR '|') AS tagGroup
FROM tbl_uploads up
LEFT JOIN tbl_users p ON up.user_id = p.user_id
LEFT JOIN tbl_collab c ON up.file = c.file AND c.approved = 'yes'
LEFT JOIN tbl_users cp ON cp.user_id = c.collab_userid
GROUP BY up.file ORDER BY up.id DESC LIMIT ?, ?");

//Where approved stops new images being displayed 

        //bind parameters for markers
        $results->bind_param("dd", $position, $item_per_page);
        $results->execute(); //Execute prepared Query
        $results->bind_result($id,$file,$title,$user_name,$user_id,$tagGroup); //bind variables to prepared statement

$i=0;

        while($results->fetch()){ //fetch values

connect.php

$servername = "localhost";
$username = "xxx";
$password = "xxx";
$dbname = "xxx";

try {
    $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

}
catch(PDOException $e) {
    echo "Error: " . $e->getMessage();
}

0 个答案:

没有答案