Bonjour
Je travaille avec windows10, php 7.4 et MSQL 5.7
Je viens de publier un site sur un serveur mutualisé. Tout fonctionne très bien, sauf la base de données. La base a été transférée sans problème sur le serveur. Par contre impossible de l'exploiter car je reçois le message d'erreur :
Fatal error: Uncaught Error: Call to a member function query() on null in /homepages/10/d895644089/htdocs/base/saisies/liste_membres.php:108
Stack trace: #0 {main} thrown in /homepages/10/d895644089/htdocs/base/saisies/liste_membres.php on line 108
Le port indiqué par le fournisseur est 3306

fichier des plus simples, le fichier liste_membres - Copie.php
Code html : 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<!DOCTYPE html>
<html lang="fr">
 
<head>
<meta charset="utf-8">
 
<title>Liste membres</title>
 
<meta name="description" content="Liste des membres inscrits dans la base.">
<meta HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
 
 
<style>
 
body { background-color : #FFFFFF; width: 98%}
 
p{padding-left :0%; text-align: justify; width: 96%; font-family:arial; font-size:15px;}
 
#titre{position:absolute; left:25%;}
.menu{position:absolute; left:28%;}
 
.rouge{color:red;} 
.bleu{color:blue}
.vert{color:green}
.blanc{color:white}
 
h1{ font-size : 30px; font-family : Arial; font-weight:bold; color : #5882FA; }
 
h2{ font-size : 26px; font-weight:bold; font-family : Arial;
color : #5882FA; text-align: left; } 
 
h3{ font-size : 22px; font-weight:bold; font-family :
Arial; color : #008080; text-align: left; } 
 
h4{ font-size : 16px; font-weight:bold;
font-family : Arial; color : #008080; text-align: left; } 
 
h5{ font-size : 14px;
font-weight:bold; font-family : Arial; color : #008080; text-align: left; } 
 
h6{ font-size :
14px; font-weight:bold; font-family : Arial; color : #008080; text-align: left; }
 
a{text-decoration:none}
 
a:link{color:blue}
a:visited{color:blue}
a:hover{color:red}
a:active{color:red}
 
p{padding-left :1%; text-align: justify; width: 98%; font-family:arial; font-size:15px;}
 
#Nom{position:absolute;left:1%; font-size : 18px; font-weight:bold; font-family :Arial; color : #008080;}
#Prenom{position:absolute;left:14%; font-size : 18px; font-weight:bold; font-family :Arial; color : #008080;}
#Mail{position:absolute;left:25%;font-size : 18px; font-weight:bold; font-family :Arial; color : #008080;}
#Telephone{position:absolute;left:40%;font-size : 20px; font-weight:bold; font-family :Arial; color : #008080;}
#IV{position:absolute;left:50%;font-size : 20px; font-weight:bold; font-family :Arial; color : #008080;}
#Code{position:absolute;left:54%;font-size : 20px; font-weight:bold; font-family :Arial; color : #008080;}
#Ville{position:absolute;left:60%;font-size : 20px; font-weight:bold; font-family :Arial; color : #008080;}
 
#nom{position:absolute; left:1%; font-family Arial; font-size:15px; color: black;}
#prenom{position:absolute;left:14%; font-family Arial; font-size:15px; color:black;}
#email{position:absolute;left:25%; font-family Arial; font-size:15px; color:black;}
#telephone{position:absolute;left:40%; font-family Arial; font-size:15px; color:black;}
#iv{position: absolute;left:50%; font-family Arial; font-size:15px; color: black;}
#code_postal{position:absolute;left:55%; font-family Arial; font-size:15px; color:}
#ville{position:absolute;left:60%; font-family Arial; font-size:15px; color:black;}
 
#mot_passe{position:absolute;left:84%; font-family Arial; font-size:15px; color:black;}
 
</style>
 
</head>
 
<body bgcolor="#FFFFFF">
 
<p><a href = "../menu_base.php">Menu de la base</a><br></p>
 
<H1><div id ="titre">Liste des membres</div><br></H1>
 
<?php
 
$host_name ='donné par fournisseur'; 
$database = 'donné par fournisseur';
$user_name = 'donné par fournisseur';
$password = 'mon password de la base';
$dbh = null;
 
try {
        $dbh = new PDO("mysql:host=$host_name; dbname=$database;", $user_name, $password);
} catch (PDOException $e) {
        echo "Erreur!: " . $e->getMessage() . "<br/>";
        die();
}
 
 
echo  '<div id = "Nom">Nom</div>',
'<div id = "Prenom">Prenom</div>',
'<div id = "Mail">Mail</div>',
'<div id = "Telephone">Tel</div>',
'<div id = "IV">IV</div>',
'<div id = "Code">CP</div>',
'<div id = "Ville">Ville</div>',
'<br />','<br />';
 
//$reponse = $bdd->query('SELECT nom,prenom,email,telephone iv,code_postal,ville FROM membres ORDER by nom');
$reponse = $bdd->query('SELECT nom FROM membres ORDER by nom');
 
 
while ($donnees = $reponse->fetch())
{       
echo  '<div id = "nom">'.ucfirst($donnees['nom']).'</div>';
/*'<div id = "prenom">'.ucfirst($donnees['prenom']).'</div>',
'<div id = "email">'.$donnees['email'].'</div>',
'<div id = "telephone">'.$donnees['telephone'].'</div>',
'<div id = "iv">'.$donnees['iv'].'</div>',
'<div id = "code_postal">'.$donnees['code_postal'].'</div>',
'<div id = "ville">'.ucfirst($donnees['ville']).'</div>',
'<br />';*/
 
}//fin while
 
$reponse->closeCursor();
 
echo '<p class = "menu"><a href = "../menu_base.php">Menu de la base</p>';
 
?>
 
</body>
</html>
Ce site était auparavant un site perso publié chez free.fr. Il existe toujours, et ma base fonctionne parfaitement, et les fichiers d'accès à la bdd avaient une structure exactement identique. Mais le site n'était pas sécurisé et sans nom de domaine propre.
Le fournisseur d'accès me dit qu'ils n'ont pas de développeurs, et me dit de m'adresser à un Webmaster.
Merci de votre aide