Vous n'êtes pas identifié(e).
L'icône rouge permet de télécharger chaque page du wiki visitée au format PDF et la grise au format ODT →
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Prochaine révision Les deux révisions suivantes | ||
utilisateurs:hypathie:tutos:php_connexion_mysql [08/07/2021 16:53] Hypathie [Objet PDO] |
utilisateurs:hypathie:tutos:php_connexion_mysql [08/07/2021 16:57] Hypathie [Objet PDO] |
||
---|---|---|---|
Ligne 172: | Ligne 172: | ||
} | } | ||
- | /*public function queryFetch($query) | + | /*public function queryFetch($query) |
- | { | + | { |
- | return $this->securConnexion()->query($query)->fetch(); | + | return $this->securConnexion()->query($query)->fetch(); |
- | }*/ | + | }*/ |
- | public function logSqlErreur() | + | public function logSqlErreur() |
- | { | + | { |
- | + | } | |
- | } | + | |
- | public function securConnexion() | + | public function securConnexion() |
- | { | + | { |
- | if(is_null($this->PDO_connexion)) | + | if(is_null($this->PDO_connexion)) |
- | $this->getConnexion(); | + | $this->getConnexion(); |
- | return $this->PDO_connexion; | + | return $this->PDO_connexion; |
- | + | } | |
- | } | + | private function getConnexion() |
- | private function getConnexion() | + | { |
- | { | + | if(!$this->getStatus()) |
- | if(!$this->getStatus()) | + | $this->PDO_connexion = parent::firstConnexion(); |
- | $this->PDO_connexion = parent::firstConnexion(); | + | return $this->PDO_connexion; |
- | return $this->PDO_connexion; | + | } |
- | } | + | public function getErreurMessage() |
- | public function getErreurMessage() | + | { |
- | { | + | return parent::getErreurMessage(); |
- | return parent::getErreurMessage(); | + | } |
- | } | + | public function getStatus() |
- | public function getStatus() | + | { |
- | { | + | return parent::getStatus(); |
- | return parent::getStatus(); | + | } |
- | } | + | public function getCallingBy() |
- | public function getCallingBy() | + | { |
- | { | + | return $this->createBy ; |
- | return $this->createBy ; | + | } |
- | } | + | public function disconnectMysql() |
- | public function disconnectMysql() | + | { |
- | { | + | parent::disconnectMysql(); |
- | parent::disconnectMysql(); | + | } |
- | } | + | |
public function __destruct(){ | public function __destruct(){ | ||
- | echo " <br/> Destructeur de gestionnairePDO "; | + | echo " <br/> Destructeur de gestionnairePDO "; |
- | } | + | } |
} | } | ||
Ligne 271: | Ligne 269: | ||
} | } | ||
- | public function getNomfromId($id) | + | public function getNomfromId($id) |
- | { | + | { |
- | $q = "SELECT name FROM users where id=" . $id . ";"; | + | $q = "SELECT name FROM users where id=" . $id . ";"; |
- | $result = $this->gestionPDO->securConnexion()->query($q)->fetch(); | + | $result = $this->gestionPDO->securConnexion()->query($q)->fetch(); |
- | //ou | + | //ou |
- | //$result = $this->gestionPDO->queryFetch($q); | + | //$result = $this->gestionPDO->queryFetch($q); |
- | return $result; | + | return $result; |
- | } | + | } |
- | + | ||
- | + | ||
- | //public function getDataTreeCountryStateCity() | + | |
- | //{ | + | |
- | // $query = "SELECT name FROM tree_country_state_city where id=1;"; | + | |
- | // $result = $this->data_tree_connexion->query($query)->fetch(); | + | |
- | // return $result; | + | |
- | + | ||
- | + | ||
- | //while($row = $result->fetch_array()) | + | |
- | //{ | + | |
- | // $sub_data["id"] = $row["id"]; | + | |
- | /// $sub_data["name"] = $row["name"]; | + | |
- | // $sub_data["text"] = $row["name"]; | + | |
- | // $sub_data["parent_id"] = $row["parent_id"]; | + | |
- | // $data[] = $sub_data; | + | |
- | //} | + | |
- | + | ||
- | //echo json_encode($data); | + | |
- | //} | + | |
} | } | ||
</code> | </code> |