[connexion base mysql avec PHP]
Fermé
dabasisko
Messages postés
4
Date d'inscription
mercredi 10 janvier 2007
Statut
Membre
Dernière intervention
13 janvier 2007
-
10 janv. 2007 à 17:18
Nixial - 26 mai 2008 à 10:17
Nixial - 26 mai 2008 à 10:17
Bonjour tout le monde!!!
J'ai un projet de finances d'entreprises à informatiser et je voudrais le faire en php pour l'apprendre.
voila j'ai créé ma base dans MYSQL et mes formulaires avec php.Cependant quand je saisis des enregistrements avec mon formulaire,je ne les vois pas dans la base.Et pourtant MYSQL est démarré.
j'espère trouver réponse à mon problème!!!Merci
J'ai un projet de finances d'entreprises à informatiser et je voudrais le faire en php pour l'apprendre.
voila j'ai créé ma base dans MYSQL et mes formulaires avec php.Cependant quand je saisis des enregistrements avec mon formulaire,je ne les vois pas dans la base.Et pourtant MYSQL est démarré.
j'espère trouver réponse à mon problème!!!Merci
A voir également:
- [connexion base mysql avec PHP]
- Gmail connexion - Guide
- Gmail connexion autre compte - Guide
- Connexion chromecast - Guide
- Site inaccessible n'autorise pas la connexion - Guide
- Mysql community server - Télécharger - Bases de données
1 réponse
P@
Messages postés
1709
Date d'inscription
vendredi 7 juillet 2000
Statut
Membre
Dernière intervention
24 mars 2009
185
11 janv. 2007 à 13:13
11 janv. 2007 à 13:13
va falloir en dire un peu plus sur ton formulaire et sa page de traitement
tu as fait ton formulaire et tu récupéres tes données comment ??
tu as fait ton formulaire et tu récupéres tes données comment ??
13 janv. 2007 à 12:21
Le formulaire est affiché et tout mais quand je valide,l'enregistrement ne figure pas dans la base de données.
<?php
/*recuperation des valeurs du formulaire*/
$numero=@$HTTP_POST_VARS['numero'];
$nom=@$HTTP_POST_VARS['nom'];
$type=@$HTTP_POST_VARS['type'];
$projet=@$HTTP_POST_VARS['projet'];
$PU=@$HTTP_POST_VARS['PU'];
$quantite=@$HTTP_POST_VARS['quantite'];
$amortissable=@$HTTP_POST_VARS['amortissable'];
$duree_amort=@$HTTP_POST_VARS['duree_amort'];
$periode=@$HTTP_POST_VARS['periode'];
/*permettre la saisie des caracteres particuliers*/
$numero=htmlentities($numero,ENT_QUOTES);
$nom=htmlentities($nom,ENT_QUOTES);
$type=htmlentities($type,ENT_QUOTES);
$projet=htmlentities($projet,ENT_QUOTES);
$PU=htmlentities($PU,ENT_QUOTES);
$quantite=htmlentities($quantite,ENT_QUOTES);
$amortissable=htmlentities($amortissable,ENT_QUOTES);
$duree_amort=htmlentities($duree_amort,ENT_QUOTES);
$periode=htmlentities($periode,ENT_QUOTES);
/* connexion*/
$connect = mysql_connect('localhost','root','') or die ("erreur de connexion");
$base="finance";
mysql_select_db($base,$connect) or die ("erreur de connexion base");
$req= "INSERT INTO produit (numero,nom,type,projet,PU,quantite,amortissable,duree_amort,periode) VALUES ('$numero','$nom','$type','$projet','$PU','$quantite','$amortissable','$duree_amort','$periode')";
$result = mysql_query($req) or die(mysql_error());
/*fermeture de la connexion*/
mysql_close($connect);
?>
<html>
<body>
<table border="1" bgcolor="" width="990"height="150">
<tr>
<td width="133"height="150">
<MARQUEE BEHAVIOR="ALTERNATE" DIRECTION="RIGHT"
WIDTH="300" HEIGHT="250" SCROLLAMOUNT="20">
<MARQUEE BEHAVIOR="ALTERNATE" DIRECTION="UP"
WIDTH="100" HEIGHT="250" SCROLLAMOUNT="10">
<MARQUEE BEHAVIOR="ALTERNATE" DIRECTION="DOWN"
WIDTH="100" HEIGHT="100" SCROLLAMOUNT="5">
<font face="Papyrus" size="4" color="#FFFF00">
Saisie
<br>
des Produits
</font>
</MARQUEE>
</MARQUEE>
</MARQUEE>
</td>
<td width=""height="150">
<br>
<div align="center">
<form method="post" action="" name="essai1">
<hr width="30%" size=2 color="darkorange" align="center" noshade="true"/>
<table border=0 width="60%" height="50%" cellspacing=10 cellpadding=10><tr>
<td align="right" valign="middle">
<font name="Stencil" color="darkorange" size=4> <b><p>Numero :<p>Nom :<p>Type :<p>Projet : <p>PU :<p>Quantité :<p>Amortissable :<p>Durée_Amortissement :<p>Période :<p></b> </font>
</td><td align="left" valign="middle">
<hr width="48%" size=1 color="darkorange" align="left" noshade="false"/>
<input type="text" name="numero" value="" size=20 maxlength=20 onFocus="this.select()">
<hr width="48%" size=1 color="darkorange" align="left" noshade="true"/>
<input type="text" name="nom" value="" size=50 maxlength=50 onFocus="this.select()">
<hr width="48%" size=1 color="darkorange" align="left" noshade="true"/>
<input type="text" name="type" value="" size=50 maxlength=50 onFocus="this.select()">
<hr width="48%" size=1 color="darkorange" align="left" noshade="true"/>
<input type="text" name="projet" value="" size=20 maxlength=50 onFocus="this.select()">
<hr width="48%" size=1 color="darkorange" align="left" noshade="false"/>
<input type="text" name="PU" value="" size=20 maxlength=20 onFocus="this.select()">
<hr width="48%" size=1 color="darkorange" align="left" noshade="false"/>
<input type="text" name="quantite" value="" size=20 maxlength=20 onFocus="this.select()">
<hr width="48%" size=1 color="darkorange" align="left" noshade="false"/>
<input type="checkbox" name="amortissable" value="ON" checked>
<hr width="48%" size=1 color="darkorange" align="left" noshade="false"/>
<input type="text" name="duree_amort" value="" size=20 maxlength=20 onFocus="this.select()">
<hr width="48%" size=1 color="darkorange" align="left" noshade="false"/>
<input type="text" name="periode" value="" size=20 maxlength=20 onFocus="this.select()">
<hr width="48%" size=1 color="darkorange" align="left" noshade="true"/>
<hr width="48%" size=1 color="darkorange" align="left" noshade="true"/>
<input type="submit" value="Valider" >
</td></tr></table>
<hr width="30%" size=2 color="darkorange" align="center" noshade="true"/>
</form>
</table>
</body>
</html>
15 janv. 2007 à 10:50
26 mai 2008 à 10:17
Crée une page "traitement.php" ou autre et mets dans ton form : <form method="post" ou method="get" action="traitement.php">
Et là je pense que l'insertion se fera sauf erreur de code :)
Voilà bonne chance !