ça marche comme synthaxe d'insertion ???insert into sla SET date='".$_POST['annee']."''".$_POST['mois']."''".$_POST['jour']."', type='".$_POST['type']."', sla='".$_POST['sla']."', total='".$_POST['total']."'";
ça marche comme synthaxe d'insertion ???insert into sla SET date='".$_POST['annee']."''".$_POST['mois']."''".$_POST['jour']."', type='".$_POST['type']."', sla='".$_POST['sla']."', total='".$_POST['total']."'";
INSERT INTO `table` (`champ_1`, `champ_2`)
VALUES ('valeur_1', 'valeur_2')
Ou bien:
UPDATE `table` SET `champ_1` = 'valeur_1', `champ_2` = 'valeur_2' WHERE `champ_id` = 'valeur_id'
et quand controles tu la validité de ta date ?en fait, c'est bon j'ai trouvé :mysql_select_db("arnis01") or die("Impossible de trouver la base"); $date = $_POST['annee']."-".$_POST['mois']."-".$_POST['jour']; $query = "insert into sla SET date='$date', type='".$_POST['type']."'"
$sql="SELECT jour,mois,annee FROM sla ORDER BY annee,mois,jour" //requete d'apelle de ta table et des infos
$req=mysql_query($sql);
while ($tab=mysql_fetch_array($req))/* on sur une ligne de la table et tant que le tableau complet n'est pas parcouru on effectue ces actions*/
{
if ($tab['mois])==1)/* si dans ta table la valeur de mois est à 1*/
{
$mois=janvier;/*on stocke janvier*/
}
else if($tab['mois']==2);
{
$mois=février;
}
...
Mais mes confrères ton donné une réponse plus efficasse il me semble n,on ?
switch($tab["mois"]) {
case1:
$mois = "janvier";
break;
case 2:
$mois = "fevrier";
break;
...
}
ou encore mieux$tabMois = array(1=>"janvier", 2=>"février", ...);
$mois = $tabMois[$tab["mois"]];
mysql_select_db("arnis01");
$str_requete ="SELECT jour, mois, annee, type, sla, total, description, action FROM sla ORDER BY annee, mois, jour";
$o_result = mysql_query($str_requete);
while ($a_result = mysql_fetch_array($o_result, MYSQL_ASSOC)) {
$tabMois = array(01=>"janvier", 02=>"février");
$mois = $tabMois[$tab["mois"]];
echo "<tr>";
echo "<td>".$a_result["jour"]."</td>";
echo "<td>".$mois."</td>";
echo "<td>".$a_result["annee"]."</td>";
echo "<td>".$a_result["type"]."</td>";
echo "<td>".$a_result["sla"]."</td>";
echo "<td>".$a_result["total"]."</td>";
echo "<td>".$a_result["description"]."</td>";
echo "<td>".$a_result["action"]."</td>";
echo "</tr>";
mysql_select_db("arnis01");
$str_requete ="SELECT jour, mois, annee, type, sla, total, description, action FROM sla ORDER BY annee, mois, jour";
$o_result = mysql_query($str_requete);
while ($a_result = mysql_fetch_array($o_result, MYSQL_ASSOC)) {
$tabMois = array(01=>"janvier", 02=>"février", 03=>"mars, 04=>"avril", 05=>"mai", 06=>"juin", 07=>"juillet", 08=>"aout", 09=>"septembre", 10=>"octobre", 11=>"novembre", 12=>"décembre");
$mois = $tabMois[$a_result["mois"]];
echo "<tr>";
echo "<td>".$a_result["jour"]."</td>";
echo "<td>".$mois."</td>";
echo "<td>".$a_result["annee"]."</td>";
echo "<td>".$a_result["type"]."</td>";
echo "<td>".$a_result["sla"]."</td>";
echo "<td>".$a_result["total"]."</td>";
echo "<td>".$a_result["description"]."</td>";
echo "<td>".$a_result["action"]."</td>";
echo "</tr>";