salut j'ai un petit soucis, en utilisant PDO notamment, quand ma requette possède un champs dans une table comme ceciavec tiret 8titre-actualite
il me renvoi cette erreur
quand j'utilise un autre champs il marche parfaitementNotice: Undefined property: stdClass::$titre in C:\wamp\www\traveaux_Saaa\artCompany\include\connection.php on line 22
Notice: Use of undefined constant actualite - assumed 'actualite' in C:\wamp\www\traveaux_Saaa\artCompany\include\connection.php on line 22
Notice: Undefined property: stdClass::$titre in C:\wamp\www\traveaux_Saaa\artCompany\include\connection.php on line 22
Notice: Use of undefined constant actualite - assumed 'actualite' in C:\wamp\www\traveaux_Saaa\artCompany\include\connection.php on line 22
Notice: Undefined property: stdClass::$titre in C:\wamp\www\traveaux_Saaa\artCompany\include\connection.php on line 22
Notice: Use of undefined constant actualite - assumed 'actualite' in C:\wamp\www\traveaux_Saaa\artCompany\include\connection.php on line 22
0
0
0
je veux s'avoir pourquoi PDO n'accepte pas les champs avec tiret 8 et comment Résoudre Mon problème MErci
Voici Mon code
connexion.php
index.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 <?php class Connexion{ private $db; // Instance de PDO public function __construct($db) { $this->setDb($db); } /********************************************/ public function getList($categorie) { $persos = array(); $q = $this->db->prepare('SELECT `titre-actualite` FROM `actualites` WHERE `categorie`= :categorie '); $q->execute(array(':categorie' => $categorie)); while ($lignes = $q->fetch(PDO::FETCH_OBJ)) { $persos[] = $lignes->titre-actualite; } return $persos; /***********************/ } /*-/////////////////////////////////////////////////////////////////////*/ /**********************************************************************/ public function setDb(PDO $db) { $this->db = $db; } } ?>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 <?php include 'include/config.php'; // connexion au BDD include 'include/connection.php'; // connexion au BDD $manager = new Connexion($db); $r = $manager->getList('artEvent'); foreach($r as $values){ echo $values.'<br>'; } ?>
Partager