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 17:00] Hypathie [Objet PDO] |
utilisateurs:hypathie:tutos:php_connexion_mysql [08/07/2021 17:03] Hypathie [Objet PDO] |
||
---|---|---|---|
Ligne 87: | Ligne 87: | ||
mysql -u root -p < ~/user/Test/nath_test.sql | mysql -u root -p < ~/user/Test/nath_test.sql | ||
</code> | </code> | ||
- | ===== Objet PDO ===== | + | ===== Singleton php ===== |
<code> | <code> | ||
Ligne 109: | Ligne 109: | ||
const SQL_USER = 'root'; | const SQL_USER = 'root'; | ||
const SQL_HOST = 'localhost'; | const SQL_HOST = 'localhost'; | ||
- | const SQL_PASS = 'arawak'; | + | const SQL_PASS = '********'; |
const SQL_DTB = 'nath_test'; | const SQL_DTB = 'nath_test'; | ||
private static $connect = null; | private static $connect = null; | ||
Ligne 235: | Ligne 235: | ||
} | } | ||
- | public function getDataTreeCountryStateCity() | + | public function getDataTreeCountryStateCity() |
- | { | + | { |
- | $q = "SELECT name FROM tree_country_state_city where id=1;"; | + | $q = "SELECT name FROM tree_country_state_city where id=1;"; |
- | $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; |
- | } | + | } |
} | } | ||
</code> | </code> |