Pour accéder à une bdd par PDO, j'ai un code qui fonctionne correctement chez un hébergeur payant mais pas chez Free (alors que avec _MySQL, pas de problème).

Code php : 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
<?php
header('Content-type: text/html; charset=UTF-8');
?>
<!DOCTYPE html>
<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="content-type">
    <title></title>
  </head>
  <body>
<?php include("menu.html"); ?>
 
    <?php 
$PARAM_hote='sql.free.fr'; // le chemin vers le serveur
$PARAM_nom_bd='-----'; // le nom de votre base de données
$PARAM_utilisateur='-----'; // nom d'utilisateur pour se connecter
$PARAM_mot_passe='---'; // mot de passe de l'utilisateur pour se connecter
$connexion = new PDO('mysql:host='.$PARAM_hote.';dbname='.$PARAM_nom_bd, $PARAM_utilisateur, $PARAM_mot_passe);	
 
	?>
  </body>
</html>

Pour le nom de la bdd, je mets n'importe quoi (en _mysql, ça marche comme ça)

définir un patient page1 page2 données patient



Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /mnt/154/sda/2/6/---/med_sport/page1.php:22 Stack trace: #0 /mnt/154/sda/2/6/---/med_sport/page1.php(22): PDO->__construct('mysql:host=sql....', '---', 'XXXXXX') #1 {main} thrown in /mnt/154/sda/2/6/---/med_sport/page1.php on line 22
quelqu'un comprend ?