[connexion base mysql avec PHP]
dabasisko
Messages postés
4
Statut
Membre
-
Nixial -
Nixial -
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
Configuration: Windows XP Internet Explorer 6.0
A voir également:
- [connexion base mysql avec PHP]
- Gmail connexion - Guide
- Hotmail connexion - Guide
- Base de registre windows - Guide
- Expert php - Télécharger - Langages
- Voe.sx n'autorise pas la connexion. ✓ - Forum Réseaux sociaux
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>
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 !