Précédent   Forum des professionnels en informatique > PHP > PHP & SGBD > PHP & MySQL
PHP & MySQL Forum d'entraide sur les fonctions MySQL avec PHP. Avant de poster -> FAQ MySQL, Cours MySQL et Sources MySQL. Pour les questions concernant le moteur MySQL plutôt que les fonctions PHP, merci d'utiliser le forum MySQL.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 23/06/2011, 12h32   #1
 
Homme khmaies guesmi
Étudiant
Inscription : avril 2011
Messages : 63
Détails du profil
Informations personnelles :
Nom : Homme khmaies guesmi
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Opérateur de télécommunications

Informations forums :
Inscription : avril 2011
Messages : 63
Points : -3
Points : -3
Par défaut probléme de réaffectation

Bonjours,

SVP, qui peut m'aider ,j'ai bessoin d'un coup de main.
J'ai un scripe php,dans le quel on a enrigistré des données concernant ds laptops date d'affectation ,non et prenom d'utilisateurs..) et je voudrai ,quand on a une resultat,on aura un button de réaffectation qui réinialise les donné
Voici le code ,et merci d'avance.
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
session_start();
include("connexion.php");
connect($host,$user,$mot_passe,$db_name);
if ( !session_is_registered("authen_user")){
#echo '<META HTTP-EQUIV="refresh" CONTENT="0;URL=index.php?erreur=404">';
#redirection instantanée
header("location:index.php?erreur=404");
}
$date = getdate();
$m = $date['mon'];
$j = $date['mday'];
$a = $date['year'];
$d= $j."/".$m."/".$a;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link href="css/style.css" rel="stylesheet">
<title></title>
</head>
<body topmargin="0" leftmargin="0">
&nbsp;
<table width="967" height="902"  border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#111111" bgcolor="#FFFFFF" style="border-collapse: collapse">
<tr>
    <td width="100%" height="126" align="left" valign="top">
         <table WIDTH="967" BORDER="0" CELLPADDING="0" CELLSPACING="0">
            <tr>
                <td COLSPAN="6"><img SRC="img/header.jpg" WIDTH="387" HEIGHT="94"></td>
           </tr>
	       <tr>
             <td width="89"><a class="linx" href="user_home.php">Consultation  </a></td>
                <td width="111"><a class="linx" href="new.php">Ajouter nouveau</a></td>
                <td width="467"><a class="linx" href="find7.php">Recherche</a></td>
             <td width="38"><a class="linx" href=""></a></td>
               <td width="175"><a class="linx" href="#6"></a></td>
               <td width="87"><a class="linx" href="deco.php">D&eacute;connecxion</a></td>
          </tr>
		  <tr>
		    <td COLSPAN="6">&nbsp;</td>
		   </tr>
      </table>
    </td>
</tr>
 <form name="f3" action="réaffecter_à_nouveau.php" method="post">
	<th height="52"><input type="submit" value="Réaffecter" ></th>
<form method="post"  action="<?php echo $_SERVER['PHP_SELF'];  ?>" >
	<!-- style="display:block;width:300px;" pour aligner le formulaire-->
	<label style="display:block;width:300px;" for="nv_nom">nouveau nom</label>
	<input  type="text" name="nvtitre" id="nv_nom" /><br/>
 
	<label style="display:block;width:300px;" for="nv_prenom">nouveau prenom</label>
	<textarea name="nvcontenu" id="nv_prenom" rows="2" cols="30"> </textarea><br/>
 
	<label style="display:block;width:300px;" for="nvlieu">nouvelle matricule</label>
	<input  type="text" name="nvlieu" id="nv_matricule" /><br/>
 
	<label style="display:block;width:300px;" for="date">nouvelle date</label><?php echo $d; ?>
	<input  type="date" name="nvdate" id="nv_date" /><br/>
	<label style="display:block;width:300px;" for="service">nouvelle service</label>
	<input  type="date" name="nvdate" id="nv_service" /><br/>
	<label style="display:block;width:300px;" for="statu_pc">nouvelle statu</label>
	<input  type="date" name="nvdate" id="nv_statu" /><br/>
	<input style="display:block;width:300px; " type="submit" value="valider les modifications" name="valider"/>
 
</form>
</fieldset>	
</html>
 
<!-- script réaffecter-->
<?php 
 
		try 
		{
			$bdd=new PDO('mysql:host=localhost;db_name=pc_sagem', 'root', '');
 
		}
 
	catch(Exception $e)
		{
			die('erreur:' .$e->getMessage());
		}
 
 
		<?php
		if (isset($_POST['valider'])&&  isset($_POST['nv_nom'])  &&  isset($_POST['nv_prenom'])  &&  
		isset($_POST['nv_matricule'])   &&  isset($_POST['nv_date'])  &&  isset($_POST['nv_service'])&&  isset($_POST['nv_statu']))
		{
		?>
			/*enregistrer les modifications de l'evenement concerné*/
			$req=$bdd->prepare('UPDATE evenement SET 
			nom=:nv_nom,
			prenom=:nv_prenom,
			matricule=:nv_matricule,
			date_affectation=:nv_date,
			service_UF=:nv_service
			WHERE id_pc=:id_de_pc');
 
			$req->execute(array(
			'nvtitre' => $_POST['nvtitre'],
			'nvcontenu' => $_POST['nvcontenu'], 
			'nvlieu' => $_POST['nvlieu'] ,
			'nvdate' => $_POST['nvdate'] ,
			'id_de_pc' => $_GET['id'] ));
			<?php
			if ($req){
			?>
			echo "votre réaffectation  est prise en compte!";
			else 
			echo "probleme de réaffectation!!!!";
 
		}
 
?>
</body>
</head>
</html>
pfakhmaies est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 05h54.


 
 
 
 
Partenaires

Hébergement Web