Quantcast
Channel: Últimos conteúdos
Viewing all articles
Browse latest Browse all 14190

Erro com método bindValue do PDO

$
0
0

tenho esse codigo:

class Querys extends PDO{
    private $cn;
    
    public function __construct(){
        try{
        $pdo = new PDO("mysql:host=localhost;dbname=u705538000_nqg","u705538000_nqg","ri150393");
        $this->cn = $pdo;
        }catch(PDOException $e){
            echo $e->getMensage();
        }
    }

public function selectLimit($tabela,$inicio,$fim){
    $pdo = $this->cn;
    $pdo->prepare("SELECT * FROM :tabela LIMIT :inicio,:fim");
    $pdo->bindValue(":tabela",$tabela,PDO::PARAM_STR); //ESSA É A LINHA 8 NO CASO
    $pdo->bindValue(":inicio",$inicio,PDO::PARAM_INT);
    $pdo->bindValue(":fim",$fim,PDO::PARAM_INT);
    $executar = $pdo->execute();
    return $executar;
}

}

quando chamo:

$q =  new Querys();
$q->selectLimit("usuarios",0,7);

da o seguinte erro no servidor ( ja ta disponivel na web )

 

Fatal error: Call to undefined method PDO::bindValue() in /home/u705538000/public_html/php/include/Querys.php on line 38


Viewing all articles
Browse latest Browse all 14190