Mise à jour connection BD
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Question

Mise à jour connection BD

by
ChristianG20
Created on 2021-10-02 15:49:54 (edited on 2024-09-04 13:53:32) in Hébergements Web

Bonjour
Suite au changement des modalités de connexion aux bases de données j'essaie de refaire fonctionner mes scripts PHP. Voici un essai de code :
> > include "global.php3";

> $s="mysql:host=".IKI_DATABASE;

> echo $s;

> echo "
";

> try {
> echo "]";echo "
";
> $db = new PDO($s,IKI_LOGIN,IKI_PASSWORD);
> foreach($db->query('SELECT * from PARC_POINT') as $row) {
> print_r($row);
> echo "+";
> echo "
";
> }
> echo "[";echo "
";
> $db=NULL;
> }
> catch (PDOException $e) {
> print "Erreur !: " . $e->getMessage() . "
";
> die();
> }
(IKI_DATABASE,IKI_LOGIN et IKI_PASSWORD sont définis dans gobal.php3)
Il ne produit pas d'erreur mais ne retourne pas le contenu de la table. La table PARC_POINT existe et est accessible avec PhPMyAdmin, elle n'est pas vide. les caratères [ et ] sont bien affichés et la chaine $s aussi. Quelqu'un voit-il une erreur dans ce code ? Merci (NB que les echo de type BR sont ici invisibles)


2 Replies ( Latest reply on 2021-10-03 09:42:30 by
fritz2cat officiel (d'avant la migration)
)


$s="mysql:host=".IKI_DATABASE

Désolé mais je ne connais pas IKI_DATABASE.

IKI_DATABASE est défini dans global.php3 comme un serveur OVH à la nouvelle mode sous la forme « .mysql.db » comme le recommande OVH.
Vous ne connaissez pas non plus IKI_PASSWORD et IKI_LOGIN mais vous vous doutez qu'il s'agit d'un nom d'utilisateur et d'un mot de passe j'espère ?

```text


global.php3


.php3 ?

ouch. Ca ne nous rajeunit pas

https://www.php.net/manual/php3.php

> The PHP 3 documentation was removed from the PHP Manual and placed here for historical purposes. An attempt was made to preserve all of the text although it's highly likely that some is missing. The last PHP 3 release (3.0.18) was made on October 20, 2000.

> See the PHP Museum for downloads, and also read the history for further information about PHP 3. ```