PHP query with DB package PEAR
Bonjour,
j'ai besoin de votre aide: Je suis entrain de construire un site dynamique avec deux package de PEAR: DB et Template IT. Je me suis un peu inspirer sur les tutoriel (abstract et non abstract) mais je suis bloqué sur ce point:
Code:
1 2 3 4 5 6 7 8 9 10 11
| function extraction_infos_DB() {
global $db;
$SQL = 'SELECT * FROM pages WHERE Id_page = :id_page';
$statement= $db->prepare($SQL);
=>>>:( $statement->excute(array(':id_page' => $_ENV['id_page']));
=>>>:( $tabl_result = $statement->fetch();
$_ENV['mots_cles'] = $tabl_result['Mots_cles'];
$_ENV['description'] = $tabl_result['Description'];
$_ENV['titre'] = $tabl_result['Titre'];
$_ENV['contenu'] = $tabl_result['Contenu'];
$_ENV['id_parent'] = $tabl_result['Id_parent']; |
l'erreur est la suivante:
Citation:
fatal error: Call to a member excute() on a non object
. J'ai l'impression comme si il ne reconnait mon instanciation de $db de Pear.
Merci à tous.
avec var_dump($db) voila ce que j'ai comme resulatats
Citation:
object(DB_mysql)#1 (26) { ["phptype"]=> string(5) "mysql" ["dbsyntax"]=> string(5) "mysql" ["features"]=> array(7) { ["limit"]=> string(5) "alter" ["new_link"]=> string(5) "4.2.0" ["numrows"]=> bool(true) ["pconnect"]=> bool(true) ["prepare"]=> bool(false) ["ssl"]=> bool(false) ["transactions"]=> bool(true) } ["errorcode_map"]=> array(26) { [1004]=> int(-15) [1005]=> int(-15) [1006]=> int(-15) [1007]=> int(-5) [1008]=> int(-17) [1022]=> int(-5) [1044]=> int(-26) [1046]=> int(-14) [1048]=> int(-3) [1049]=> int(-27) [1050]=> int(-5) [1051]=> int(-18) [1054]=> int(-19) [1061]=> int(-5) [1062]=> int(-5) [1064]=> int(-2) [1091]=> int(-4) [1100]=> int(-21) [1136]=> int(-22) [1142]=> int(-26) [1146]=> int(-18) [1216]=> int(-3) [1217]=> int(-3) [1356]=> int(-13) [1451]=> int(-3) [1452]=> int(-3) } ["connection"]=> resource(7) of type (mysql link) ["dsn"]=> array(9) { ["phptype"]=> string(5) "mysql" ["dbsyntax"]=> string(5) "mysql" ["username"]=> string(4) "root" ["password"]=> string(0) "" ["protocol"]=> bool(false) ["hostspec"]=> string(9) "localhost" ["port"]=> bool(false) ["socket"]=> bool(false) ["database"]=> string(7) "bdcvcci" } ["autocommit"]=> bool(true) ["transaction_opcount"]=> int(0) ["_db"]=> string(7) "bdcvcci" ["fetchmode"]=> int(1) ["fetchmode_object_class"]=> string(8) "stdClass" ["was_connected"]=> NULL ["last_query"]=> string(0) "" ["options"]=> array(8) { ["result_buffering"]=> int(500) ["persistent"]=> bool(false) ["ssl"]=> bool(false) ["debug"]=> int(2) ["seqname_format"]=> string(6) "%s_seq" ["autofree"]=> bool(false) ["portability"]=> int(63) ["optimize"]=> string(11) "performance" } ["last_parameters"]=> array(0) { } ["prepare_tokens"]=> array(1) { [0]=> array(1) { [0]=> string(36) "SELECT Id_page FROM pages from pages" } } ["prepare_types"]=> array(1) { [0]=> array(0) { } } ["prepared_queries"]=> array(1) { [0]=> string(36) "SELECT Id_page FROM pages from pages" } ["_last_query_manip"]=> bool(false) ["_next_query_manip"]=> bool(false) ["_debug"]=> bool(false) ["_default_error_mode"]=> NULL ["_default_error_options"]=> NULL ["_default_error_handler"]=> string(0) "" ["_error_class"]=> string(8) "DB_Error" ["_expected_errors"]=> array(0) { } }
l'objet DB est reconnu mais impossible de l'exécuter.