Bonjour,
Je débute en PHP et j'essaye de faire une site pour la gestion de base de données pour mon entreprise.
mais je suis bloqué dans la page ou je vais afficher l'historique des clients (fiche client).
dans cette fiche Je dois lister tous les produits acheté par chaque client . Et chaque produit peut se transfert d'un client à un autre donc on a besoin d'une fonction qui en utilisant une liste déroulant des nom des clients existants dans la base dèja pour que l'utilisateur choisi un.
Le soucis c'est que le div du transfert dois s'afficher en dessous du produit choisi.donc j'aurais deux boucle imbriqué la premiére pour récupérer les produits et la deuxiéme pour récuperer les clients.
j'espére que j'ai bien expliqué j'utilise dreamweaver pour la création de mon site.
Voilà le code

Code php : Sélectionner tout - Visualiser dans une fenêtre à part
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
// retracer les produit acheté par ce client
$colname_even_modi = "-1";
if (isset($_GET['id_customer'])) {
$colname_achat_even = $_GET['id_customer'];}
mysql_select_db($database_Manatec, $Manatec);
$query_achat_even = sprintf("SELECT Evenement.date_evenement,Produit.id_produit, Produit.type_de_produit , Produit.num_serie_produit, Produit.statut_produit FROM ((Client INNER JOIN Evenement ON Client.id_client=Evenement.id_client ) INNER JOIN subir ON Evenement.id_evenement = subir.id_evenement)INNER JOIN Produit ON subir.id_produit=Produit.id_produit WHERE Evenement.id_client=%s AND Evenement.type_evenement='Bought'", GetSQLValueString($colname_achat_even, "int"));
$achat_even = mysql_query($query_achat_even, $Manatec) or die(mysql_error());
$row_achat_even = mysql_fetch_assoc($achat_even);
$totalRows_achat_even = mysql_num_rows($achat_even);
// récupérer les clients
$query_client = "SELECT id_client, type_client, nom, organization FROM Client";
$client = mysql_query($query_client, $Manatec) or die(mysql_error());
 
.
.
.
// le div qui contient la liste des produits avec les fonctions
<div id="hist_client">
 
<B> <I><FONT COLOR="#040404"> Bought <?php echo $totalRows_achat_even ?> products :</FONT> </I> </B>
<?php for ($nombre_de_lignes1 = 1; $nombre_de_lignes1 <= mysql_num_rows($achat_even); $nombre_de_lignes1++){
$row_achat_even = mysql_fetch_assoc($achat_even);?>
<li>
<table width="766" align="center" class="lis_bo">
<tr>
<td width="400" height="25" > <B> <I>Purchase Date</I></B> : <?php echo $row_achat_even['date_evenement']; ?></td>
<td width="117" rowspan="4" align="center" class="bouton_list1"><a href="ficheClient.php?id_customer=<?php echo $_GET['id_customer']; ?>&a=<?php echo $row_achat_even['id_produit']; ?>&g=affich" > transfert </a></td>
<td width="117" rowspan="4" align="center" class="bouton_list1" ><a href="ficheClient.php?id_customer=<?php echo $_GET['id_customer']; ?>&a=<?php echo $row_achat_even['id_produit']; ?>&h=affich" >change statut</a></td>
<td width="117" rowspan="4" align="center" class="bouton_list1" ><a href="ficheClient.php?id_customer=<?php echo $_GET['id_customer']; ?>&a=<?php echo $row_achat_even['id_produit']; ?>&k=affich" >A.S.S.</a></td>
</tr>
<tr>
<td height="25" ><B> <I>Product type </I></B>: <?php echo $row_achat_even['type_de_produit']; ?></td>
</tr>
<tr>
<td height="25" ><B> <I> Serial number</I></B> :<a href="ficheproduit.php"><?php echo $row_achat_even['num_serie_produit']; ?></a></td>
</tr>
</table>
</li>
<?php if ($_GET['g']=="affich"&& $row_achat_even['id_produit']==$_GET['a'])
$etatt_div="";
else
$etatt_div="none";
?>
// le div du fonction transfert :s'affiche en dessous du produit lorsque on clique sur le lien transfert
<div style="display:<?php echo $etatt_div;?>" class="center">
<form action="transfert.php" method="post" >
// la liste contient le nom du client et l'organization et retourne l'id client comme valeur
<B> <I>select a customer :</I></B>
<select name="trans_pro2" class="text-long" >
<option> Organization : customers </option>
<?php for ($nombre_de_lignes = 1; $nombre_de_lignes <= mysql_num_rows($client); $nombre_de_lignes++){
$donnees = mysql_fetch_array($client);?>
<option value="<?php echo $donnees['id_client']; ?>">
<?php echo $donnees['organization']; ?>
: <?php echo $donnees['nom']; ?></option>
<?php }?>
</select>
 
<B> <I> set product status :</I> </B>
<select class="text-long1" name="statupro">
<option selected="selected" value="<?php echo $row_achat_even['statut_produit']; ?>"><?php echo $row_achat_even['statut_produit']; ?></option>
<option value="Bought">Bought</option>
<option value="Lended">Lended</option>
<option value="On a trial basis">On a trial basis </option>
<option value="In stock">In stock</option>
<option value="In transfer">In transfer</option>
<option value="Rented">Rented</option>
</select>
 
<br/> <input name="location1" type="radio" value="" onclick="javascript: $('#location_acha').hide('slow');"/>
<B> <I>Same of Customer Location</I></B>
<input name="location1" type="radio" onclick="javascript: $('#location_acha').show('slow');" value="1" />
<B> <I> Other location</I></B>
<span id= "location_acha">
<input name="location-tran" type="text" class="text-long" />
</span>
 
<input name="loc" type="hidden" value="<?php echo $row_joining['adresse'];?>" />
<input name="id_pro_tran" type="hidden" value="<?php echo $row_achat_even['id_produit']; ?>" />
<br/>
<input name="confirm" type="submit" value="confirm" class="boutton" />
 
</form>
</div>
.
.
.
<?php } ?>
</div>
avec ce code la liste des clients est réussi seulment avec le premier produit dans ma listes des produits.
et nn pas pour les autres.
comment faire ?
merci d'avance