probleme de Requette d'isertion recuurent
Posté : 23 oct. 2014, 21:18
Bonsoir j'ai un petit souci avec ma requete d'insertion. tout les ellements s'inserenr dans la base sauf ' type de marche'.
voici mon code
<?php require_once('Connections/connexion.php');?>
<?php $type_de_marche="";?>
......
if ((isset($_POST["MM_insert"])) ){
mysql_select_db($database_connexion, $connexion);
$query_Recordset5 = "SELECT type_de_marche, count(id_finances) as nombretype ,sum(montant) as Montant FROM finances group by type_de_marche" ;
$Recordset5 = mysql_query($query_Recordset5, $connexion) or die(mysql_error());
$row_recordset5 = mysql_fetch_assoc($Recordset5);
$total=mysql_num_rows($Recordset5);
$insertSQL = sprintf("INSERT INTO finances (montant, date, type_de_marche) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['montant'], "text"),
GetSQLValueString($_POST['date'], "text"),
GetSQLValueString($_POST['type_de_marche'], "text"));
mysql_select_db($database_connexion, $connexion);
$Result1 = mysql_query($insertSQL, $connexion) or die(mysql_error());
}
mysql_select_db($database_connexion, $connexion);
$query_Recordset3 = "SELECT * FROM type_de_marche ";
$Recordset3 = mysql_query($query_Recordset3, $connexion) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);
?>
....
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Categorie:</td>
<td><label>
<select name="categorie" id="categorie">
<option>Choisir </option>
<option selected="selected" value="<?php echo $type_de_marche; ?>"><?php echo $type_de_marche; ?></option>
<option>Fourniture</option>
<option>Service</option>
<option>Travaux</option>
</select>
</label> </td>
<td> </td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Date
<input name="date" type="text" id="date" /></td>
<td>Montant
<input name="montant" type="text" id="montant" /></td>
<td> </td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Inserer"></td>
<td> </td>
</tr>
</table>
voici mon code
<?php require_once('Connections/connexion.php');?>
<?php $type_de_marche="";?>
......
if ((isset($_POST["MM_insert"])) ){
mysql_select_db($database_connexion, $connexion);
$query_Recordset5 = "SELECT type_de_marche, count(id_finances) as nombretype ,sum(montant) as Montant FROM finances group by type_de_marche" ;
$Recordset5 = mysql_query($query_Recordset5, $connexion) or die(mysql_error());
$row_recordset5 = mysql_fetch_assoc($Recordset5);
$total=mysql_num_rows($Recordset5);
$insertSQL = sprintf("INSERT INTO finances (montant, date, type_de_marche) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['montant'], "text"),
GetSQLValueString($_POST['date'], "text"),
GetSQLValueString($_POST['type_de_marche'], "text"));
mysql_select_db($database_connexion, $connexion);
$Result1 = mysql_query($insertSQL, $connexion) or die(mysql_error());
}
mysql_select_db($database_connexion, $connexion);
$query_Recordset3 = "SELECT * FROM type_de_marche ";
$Recordset3 = mysql_query($query_Recordset3, $connexion) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);
?>
....
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Categorie:</td>
<td><label>
<select name="categorie" id="categorie">
<option>Choisir </option>
<option selected="selected" value="<?php echo $type_de_marche; ?>"><?php echo $type_de_marche; ?></option>
<option>Fourniture</option>
<option>Service</option>
<option>Travaux</option>
</select>
</label> </td>
<td> </td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Date
<input name="date" type="text" id="date" /></td>
<td>Montant
<input name="montant" type="text" id="montant" /></td>
<td> </td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Inserer"></td>
<td> </td>
</tr>
</table>