Bonsoir
J'ai un petit souci d'appel avec une base de données faite sous Wamp SCP. J'ai un message qui ne trouve pas le bon chemin ou mot de passe ?? bref il y a un petit bug au niveau de la lecture de table.
Pour info je travaille en localhost , root .
Si quelqu'un peut eclairer ma lanterne
Voici le code php qui appel les éléments de la table tarif_bateau_vec :
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
23
24
25
26
27 <html> <body> <?PHP $db = mysql_connect('localhost', 'root', 'pomme'); mysql_select_db('essai.php',$db); $sql = 'SELECT * FROM tarif_bateau_vec'; $req = mysql_query($sql) or die('Erreur SQL ! '.$sql.' '.mysql_error()); while($data = mysql_fetch_array($req)) { echo "<div align=\"center\"><center> <table border=\"1\"> <tr> <td>"; echo $data['ref_tar_vec']; echo "</td> <td>"; echo $data['cat']; echo "</td> </tr> <tr><td>"; echo $data['prix']; echo "</td> <td>"; echo $data['lon']; echo "</td> </tr> </table> </center></div>"; } mysql_close(); ?> </body> </html>
Le message d'erreur quand je lance ma page pour afficher la tableau:
Une photo de ma table sous phpadmin :Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) in C:\wamp\www\essai\essai.php on line 6
Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in C:\wamp\www\essai\essai.php on line 7
Erreur SQL ! SELECT * FROM tarif_bateau_vec No database selected
Merci d'avance
Partager