bonjour,
j’utilise wamp server 2.2
et j'arrive a me connecter a ma base de donnée , j'ai fais un exemple et ça na pas marcher
fichier vgv.php
fichier html
Code : 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 <?php $mysql_hostname ="127.0.0.1" ; $mysql_username ="root"; $mysql_password =""; $mysql_database ="bd1"; $con =mysql_connect($mysql_hostname,$mysql_username,$mysql_password,$mysql_database); $sql="INSERT INTO t2 (idinc, nom) VALUES ('$_POST[firstname]','$_POST[lastname]')"; $result =mysql_query($sql); if ($result == 0) echo("<b>Erreur " . mysql_errno() . ": " . mysql_error() . "</b>"); elseif (mysql_num_rows($result) == 0) echo("<b>Requête exécutée avec succès</b>"); mysql_close($con); ?>
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 <?xml version="1.0" encading="UTF_8" ? > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml=:lang="fr" lang="fr"> <head> <title> titre </title> <meta http-equip="content type" content="text/html;charset=utf-8" /> <!--- balises --> </head> <body> <form action="vgv.php" method="post"> Firstname: <input type="text" name="firstname"> Lastname: <input type="text" name="lastname"> Age: <input type="text" name="age"> <input type="submit"> </form> </body> </html>
ERROR Absence de base de donnée
merçi de m'aider
Partager