CONNEXION
  • RetourJeux
    • Sorties
    • Hit Parade
    • Les + populaires
    • Les + attendus
    • Soluces
    • Tous les Jeux
    • Gaming
  • RetourActu Gaming
    • News
    • Astuces
    • Tests
    • Previews
    • Toute l'actu gaming
  • RetourBons plans
    • Bons plans
    • Bons plans Smartphone
    • Bons plans Hardware
    • Bons plans Image et Son
    • Bons plans Amazon
    • Bons plans Cdiscount
    • Bons plans Decathlon
    • Bons plans Fnac
    • Tous les Bons plans
  • RetourJVTech
    • Actus High-Tech
    • Intelligence Artificielle
    • Smartphones
    • Mobilité urbaine
    • Hardware
    • Image et son
    • Tutoriels
    • Tests produits High-Tech
    • Guides d'achat High-Tech
    • JVTech
  • RetourCulture
    • Actus Culture
    • Culture
  • RetourVidéos
    • A la une
    • Gaming Live
    • Vidéos Tests
    • Vidéos Previews
    • Gameplay
    • Trailers
    • Chroniques
    • Replay Web TV
    • Toutes les vidéos
  • RetourForums
    • Hardware PC
    • PS5
    • Switch 2
    • Xbox Series
    • Switch
    • Pokemon pocket
    • FC 25 Ultimate Team
    • League of Legends
    • Tous les Forums
  • PC
  • PS5
  • Xbox Series
  • Switch 2
  • PS4
  • One
  • Switch
  • iOS
  • Android
  • MMO
  • RPG
  • FPS
En ce moment Genshin Impact Valhalla Breath of the wild Animal Crossing GTA 5 Red dead 2
Liste des sujets

passage info de formulaire a bdd

I_am_a_mootix
I_am_a_mootix
Niveau 7
18 mai 2006 à 18:10:11

salut , voila je veut fiare un code php pour crée des comptes mais voila j´ai un probleme, je pense que c´ets mon insert into qui ne prend pas en compte les superglobales.

voila mon code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stric
t//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>Bienvenue sur BigCity</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form method=post action=creecompte>
<input type=text name=pseudo />
<input type=password name=mdp />
</form>

<?php
mysql_connect ("localhost","root","");
mysql_select_db("test");

mysql_query("INSERT INTO creecompte (id, pseudo, mdp) VALUES (´ ´, ´$_POST[´name´]´, ´$_POST[´mdp´]´ )");

mysql_close();
?>
</body>
</html>

svp , merci de m´aider :d

deepblue
deepblue
Niveau 16
18 mai 2006 à 18:11:55

<?php
mysql_connect ("localhost","root","");
mysql_select_db("test");

$name = $_POST[´name´];
$mdp = $_POST[´mdp´];

mysql_query("INSERT INTO creecompte (id, pseudo, mdp) VALUES (´ ´, ´$name´, ´$mdp´ )");

mysql_close();
?>

I_am_a_mootix
I_am_a_mootix
Niveau 7
18 mai 2006 à 18:17:47

merciiiii, :merci: c´est cool

I_am_a_mootix
I_am_a_mootix
Niveau 7
18 mai 2006 à 18:33:32

marche pas, il me dit sue y´a 300erreures ou si je met MON code juste en enlevant les $_POST en les remplacant par des $name ( par exemple) il me rajoute dans la bdd name pour le nom name et ilme rajoute mdp pour le nom mdp voila svp...

I_am_a_mootix
I_am_a_mootix
Niveau 7
18 mai 2006 à 18:44:39

:svp:

bogoss91
bogoss91
Niveau 9
18 mai 2006 à 18:58:47

j´ai pas bien compris il est où ton pb maintenant

I_am_a_mootix
I_am_a_mootix
Niveau 7
18 mai 2006 à 19:16:38

bon voila les deux codes et les deux problemes:

1)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stric
t//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>Bienvenue sur BigCity</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form method=post action=creecompte.php>
<input type=text name=pseudo />
<input type=password name=mdp />
<input type=submit />
</form>

<?php
mysql_connect ("localhost","root","");
mysql_select_db("test");

$name = $_POST[´name´];
$mdp = $_POST[´mdp´];

mysql_query("INSERT INTO creecompte (id, pseudo, mdp) VALUES (´ ´, ´$name´, ´$mdp´ )");

mysql_close();
?>
</body>
</html>

Probleme: Celui n´enregistre rien.

2)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stric
t//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>Bienvenue sur BigCity</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form method=post action=creecompte.php>
<input type=text name=pseudo />
<input type=password name=mdp />
<input type=submit />
</form>

<?php
mysql_connect ("localhost","root","");
mysql_select_db("test");

mysql_query("INSERT INTO creecompte (id, pseudo, mdp) VALUES (´ ´, ´$name´, ´$mdp´ )");

mysql_close();
?>
</body>
</html>

probleme:sa crée dans la bdd dans la colonne:"name" une information appellé "name" sera crée et dans la colonne:"mdp" une information appellé "mdp" sera crée.
C´est a cause des varaiables , la bdd enleve le signe $ et puis il ajoute :(

I_am_a_mootix
I_am_a_mootix
Niveau 7
18 mai 2006 à 19:45:49

en gros si dans insert into je met $globbe_trotter il ajoutera : "globbe_trotter".

--Rpgmaster--
--Rpgmaster--
Niveau 10
18 mai 2006 à 20:14:14

<?php
mysql_connect ("localhost","root","");
mysql_select_db("test");

$pseudo = $_POST[´pseudo´];
$mdp = $_POST[´mdp´];

mysql_query("INSERT INTO creecompte (id, pseudo, mdp) VALUES (´ ´, ´".$pseudo."´, ´".$mdp."´ )");

mysql_close();
?>

pense a retaper les apostrophes car jv.com ne mets pas les bons

I_am_a_mootix
I_am_a_mootix
Niveau 7
19 mai 2006 à 19:12:09

comment sa jv ne met pas les bons ?? ????

deepblue
deepblue
Niveau 16
19 mai 2006 à 19:15:00

les apostrophes sont remplacés par ´

Sous forums
  • Aide à l'achat Mac
  • Internet
  • Macintosh
  • Création de sites web
  • Création de Jeux
  • Linux
  • Programmation
  • Steam Deck
  • Hardware
La vidéo du moment