IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

ASP Discussion :

Créer une selection pour chaque membre depuis une même table


Sujet :

ASP

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    90
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 90
    Points : 47
    Points
    47
    Par défaut Créer une selection pour chaque membre depuis une même table
    Bonjour,

    J'ai une requete qui me permet d'afficher la liste des congrès (depuis ma Tbl_Congrès) et faire une selection depuis cette liste.
    J'ai une seconde requete qui me permet d'enregistrer ma selection dans ma Tbl_SelectionMonCompte.
    Tout ca fonctionne à merveille, mais maintenant j'aimerai que chaque membres puissent faire sa propre selection. Est-ce possible. Si oui j'aimerai garder mes pages existantes. (ci-joint mes pages)

    En espérant avoir été assez clair

    Cédric
    Fichiers attachés Fichiers attachés

  2. #2
    Expert éminent
    Avatar de Immobilis
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mars 2004
    Messages
    6 559
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Mars 2004
    Messages : 6 559
    Points : 9 506
    Points
    9 506
    Par défaut
    Salut,
    Citation Envoyé par cedric/copy Voir le message
    En espérant avoir été assez clair

    Cédric
    Pas trop...
    Tu veux que les internautes puissent remplir la table "Tbl_SelectionMonCompte"?
    Comment tu remplis cette table normalement?

    A+
    "Winter is coming" (ma nouvelle page d'accueil)

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    90
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 90
    Points : 47
    Points
    47
    Par défaut
    Bonjour Immobilis,

    J'ai ma première page avec ma requete qui affiche la liste des congrès
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    <%
    SELECT CASE Request.Querystring("modeAff")
    	CASE "","LaListe"
    '-------------------------------------------------------------------------------------------------------------------	
    		varMois=Month(Now)
    		strRequete="SELECT * FROM Tbl_Congres ORDER BY ID_num"
     
    		Set RsCongres=Server.CreateObject("ADODB.Recordset")
    		RsCongres.Open strRequete,Connexion
    		If Not RsCongres.Eof Then
    %>
    Je fais mon choix en cochant les congrès que je souhaite sélectionner
    Code : 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
     
    			<form name="SELECTION" method="get" action="selection_actuelle.asp">
    <%		
    			indx=0
    			While Not RsCongres.Eof
    				indx=indx+1
    				strRequete="SELECT * FROM Tbl_Selection WHERE numero_Congres=" & RsCongres("Id_num")
    				Set RsSelection=Server.CreateObject("ADODB.Recordset")
    				RsSelection.Open strRequete,Connexion
    				If Not RsSelection.Eof Then
    					Numero_Inscription=RsCongres("Id_num")
    				Else
    					Numero_Inscription=0	
    				End If
    				Set RsSelection=Nothing
     
    				varChaine=Rtrim(RsCongres("debut_congres"))
    '				varMonth=cInt(Mid(varChaine,4,2))
    '				varYear=cInt(Mid(varChaine,7,4))
    				varMonth=Mid(varChaine,4,2)
    				varYear=Mid(varChaine,7,4)
     
    				If varMonth>=varMois And varYear>=Year(Now) Then
    %>					
    						<tr>
    							<td width="2%" bgcolor="#FFFFFF">
    							<%If Numero_Inscription=RsCongres("Id_num") Then%>
    	                            <input type="checkbox" name="cb_Congres" value="<%=RsCongres("Id_num")%>" checked style="color: #0000FF;border-style: solid; border-width: 1; background-color: #FFFFFF">
    <%Else%>
    	                            <input type="checkbox" name="cb_Congres" value="<%=RsCongres("Id_num")%>" style="color: #0000FF;border-style: solid; border-width: 1; background-color: #FFFFFF"></td>
    							<%End If%>	
    <%
    							If indx mod 2 Then
    %>						
    								<td width="58%" bgcolor="#FFFFFF"><a href="selection_congres.asp?Individuel=Oui&specialite=<%=Request.Querystring("specialite")%>&pays=<%=Request.Querystring("pays")%>&Ville=<%=Request.Querystring("Ville")%>&Mois=<%=Request.Querystring("Mois")%>&numCongres=<%=RsCongres("id_num")%>&modeAff=LaFiche"><font color="black"><%=RsCongres("intitule")%></font></a></td>
    								<td width="10%" bgcolor="#FFFFFF"><font color="black"><%=RsCongres("Ville")%></font>&nbsp;</td>
    								<td width="10%" bgcolor="#FFFFFF"><font color="black"><%=RsCongres("debut_congres")%></font>&nbsp;</td>
    								<td width="10%" bgcolor="#FFFFFF"><font color="black"><%=RsCongres("fin_congres")%></font>&nbsp;</td>
     
    <%
    							else
    %>								
    								<td width="58%"><a href="selection_congres.asp?Individuel=Oui&specialite=<%=Request.Querystring("specialite")%>&pays=<%=Request.Querystring("pays")%>&Ville=<%=Request.Querystring("Ville")%>&Mois=<%=Request.Querystring("Mois")%>&numCongres=<%=RsCongres("id_num")%>&modeAff=LaFiche"><font color="black"><%=RsCongres("intitule")%></font></a></td>
    								<td width="10%"><font color="black"><%=RsCongres("Ville")%></font>&nbsp;</td>
    								<td width="10%"><font color="black"><%=RsCongres("debut_congres")%></font>&nbsp;</td>
    								<td width="10%"><font color="black"><%=RsCongres("fin_congres")%></font>&nbsp;</td>
    <%
    							End If
    %>
     
     
    						</tr>
    <%
    				End If	
    				indice=indice+1
    				RsCongres.MoveNext
    			Wend
    %>
    				<tr>
    					<td colspan="5" width="100%">&nbsp;</td>
    				</tr>
    				<tr>	
    					<td colspan="5" width="100%" align="center">
                        <input type="submit" name="Action" value="Valider la sélection" style="border-style: solid; border-width: 1; background-color: #CCFFEB">&nbsp;<input type="submit" name="Action" value="Retour à la liste" style="border-style: solid; border-width: 1; background-color: #CCFFEB"></td>
    				</tr>
    			</form>
    			</table>
    <%			
    		End If
    		Set RsCongres=Nothing
    %>
    et ma deuxième page avec mes requetes pour modifier, supprimer ou visualiser ma sélection
    Code : 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
    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
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
     
    <%
    Select Case Request.Querystring("Action")
     
    	Case "Annuler la sélection"
    		strRequete="DELETE FROM Tbl_Selection"
    		Set RsDelete=Server.CreateObject("ADODB.Recordset")	
    		RsDelete.Open strRequete,Connexion
    		Set RsDelete=Nothing
     
    	Case "Modifier la sélection","Nouvelle sélection"
    		Response.Redirect "selection_congres.asp?pays=France&modeAff=LaListe"
     
    	Case "Valider la sélection"
     
    		'Réinitialisation de la table des sélections
     
    		strRequete="DELETE FROM Tbl_Selection"
    		Set RsDelete=Server.CreateObject("ADODB.Recordset")	
    		RsDelete.Open strRequete,Connexion
    		Set RsDelete=Nothing
    		For i=1 to Request.Querystring("cb_Congres").count
     
    		'Affichage du titre du congrès sélectionné
     
    		'Inscription du numéro de ce congrès dans la table des sélections
     
    		strRequete="INSERT INTO Tbl_Selection(numero_congres) VALUES(" & Request.Querystring("cb_Congres")(i) & ")"
    		Set RsInsert=Server.CreateObject("ADODB.Recordset")
    		RsInsert.Open strRequete,Connexion
    		Set RsInsert=Nothing		
    		Next
     
     
    End Select	
    %>
     
    <head>
    <meta name="VI60_defaultClientScript" content="VBScript">
    <meta name="Author" content="Visicom Média Inc.">
    <meta name="Description" content>
    <meta name="Keywords" content>
    <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>GICM-Administration</title>
    <link rel="stylesheet" type="text/css" href="../styles/pages.css">
    <script type="text/javascript" language="javascript" src="sniffer.js"></script>
    <script type="text/javascript" language="javascript1.2" src="custom.js"></script>
    <script type="text/javascript" language="javascript1.2" src="style.js"></script>
     
    <style fprolloverstyle>A:hover {color: #FF0000; font-weight: bold}
    </style>
    </head>
     
    <body>
    <script type="text/javascript" language="javascript1.2" src="menu.js"></script>
    <p>&nbsp;</p>
    <p style="text-align: center"><font color="#FF0000"><b><u>CONGRÈS DU MOIS : SÉLECTION ACTUELLE</u></b></font></p>
    <p>&nbsp;</p>
    <%
    strRequete="SELECT * FROM Tbl_Selection"
    Set RsSelection=Server.CreateObject("ADODB.Recordset")
    RsSelection.Open strRequete,Connexion
    If RsSelection.Eof Then
    %>
    	<center>
    		<table border="0" width="35%" style="border-collapse: collapse" cellpadding="0" cellspacing="0">
    			<tr>
    				<form method="get" action="selection_actuelle.asp">
    					<td width="50%" align="center">
    					<input type="submit" name="Action" value="Nouvelle sélection" style="border-style: solid; border-width: 1px; "></td>
    				</form>
    			</tr>	
    		</table>
    	</center>	
    	<br><b><i><font color="#800000">Aucun congrès sélectionné</font><font color="#00FF00">
    <%Else%> </font></i></b>
    	<center>
    		<table border="0" width="35%" style="border-collapse: collapse" cellpadding="0" cellspacing="0">
    			<tr>
    				<form method="get" action="selection_actuelle.asp">
    					<td width="50%">
    	                <input type="submit" name="Action" value="Annuler la sélection" style="border-style: solid; border-width: 1px; "></td>
    					<td width="50%">
            	        <input type="submit" name="Action" value="Modifier la sélection" style="border-style: solid; border-width: 1px; "></td>
    				</form>
    			</tr>	
    		</table>
    	</center>	
     
    	<p><font face="Arial" size="2" color="#000000">Pour voir la fiche descriptive d'un congrès, cliquez sur son titre</font></p>
     
    <table border="1" width="100%" style="border-collapse: collapse" cellpadding="0" cellspacing="3" bordercolorlight="#FFFFCC">
    	<tr>
    		<td width="2%" bgcolor="#FFFFCC"><font color="#FF0000"><b>N°</b></font></td>
    		<td width="78%" bgcolor="#FFFFCC"><b><font color="#FF0000">Titre</font></b></td>
    		<td width="10%" bgcolor="#FFFFCC"><b><font color="#FF0000">Ville</font></b></td>
    		<td width="5%" bgcolor="#FFFFCC"><b><font color="#FF0000">Du</font></b></td>
    		<td width="5%" bgcolor="#FFFFCC"><b><font color="#FF0000">Au</font></b></td>
    	</tr>
    <%
    	i=1
    	While Not RsSelection.Eof
     
    		strRequete="SELECT * FROM Tbl_Congres WHERE Id_Num=" & RsSelection("numero_congres") 
    		Set RsLecture=Server.CreateObject("ADODB.Recordset")
    		RsLecture.Open strRequete,Connexion
    		If indice mod 2 Then
    %>		
     
    		<tr>
    			<td width="2%" bgcolor="#FFFFFF"><font name="arial" size="2" color="#00FF00"><b><%=i%></b></font>&nbsp;</td>
    			<td width="54%" bgcolor="#FFFFFF"><font name="arial" size="2" color="black"><a style="text-decoration : none; color: black" href="fiches_selection.asp?numCongres=<%=RsLecture("Id_num")%>"><%=RsLecture("intitule")%></a></font>&nbsp;</td>
    			<td width="20%" bgcolor="#FFFFFF"><font name="arial" size="2" color="black"><%=RsLecture("Ville")%></font>&nbsp;</td>
    			<td width="12%" bgcolor="#FFFFFF"><font name="arial" size="2" color="black"><%=RsLecture("debut_congres")%></font>&nbsp;</td>
    			<td width="12%" bgcolor="#FFFFFF"><font name="arial" size="2" color="black"><%=RsLecture("fin_congres")%></font>&nbsp;</td>
    		</tr>
    <%
    		Else
    %>		
    		<tr>
    			<td width="2%"><font name="arial" size="2" color="#00FF00"><b><%=i%></b></font>&nbsp;</td>
    			<td width="54%"><font name="arial" size="2" ><a style="text-decoration : none; color: black" href="fiches_selection.asp?numCongres=<%=RsLecture("Id_num")%>"><%=RsLecture("intitule")%></a></font>&nbsp;</td>
    			<td width="20%"><font name="arial" color="#000000" size="2" ><%=RsLecture("Ville")%></font>&nbsp;</td>
    			<td width="12%"><font name="arial" color="#000000" size="2" ><%=RsLecture("debut_congres")%></font>&nbsp;</td>
    			<td width="12%"><font name="arial" color="#000000" size="2" ><%=RsLecture("fin_congres")%></font>&nbsp;</td>
    		</tr>
     
    <%
    		End If
    		Set RsLecture=Nothing
    		indice=indice+1
    		RsSelection.Movenext	
    		i=i+1
    	Wend	
    End If		
    %>
    	</table>
    Actuellement, je suis le seul a pouvoir faire une sélection. J'aimerai que chaque internautes puissent faire sa propre sélection (la modifier, la supprimer comme bon lui semble) grâce à son identifiant.

    Cédric.

  4. #4
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    90
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 90
    Points : 47
    Points
    47
    Par défaut
    Re,

    J'ai réussi à faire une sélection en fonction de l'id de l'internaute.

    Il me reste un petit souci à régler.

    Lorsque l'internaute X veut créer sa sélection, la liste des congrès s'affiche, mais certains congrès sont déjà cochés (il s'agit des sélections des internautes A,B,C,D...) comment faire pour qu'aucun congrès soit coché lors d'une première sélection.
    Et mon deuxième souci est : une fois la sélection faite si l'internaute X veut modifier sa sélection la liste avec ses congrès s'affiche, mais aussi les congrès sélectionnés par les internautes A,B,C,D...).

    Voici le code qui me permet d'afficher la liste des congrès
    Code : 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
    90
     
    <%
    SELECT CASE Request.Querystring("modeAff")
    	CASE "","LaListe"
    '-------------------------------------------------------------------------------------------------------------------	
    		varMois=Month(Now)
    		strRequete="SELECT * FROM Tbl_Congres ORDER BY Id_num"
     
    		Set RsCongres=Server.CreateObject("ADODB.Recordset")
    		RsCongres.Open strRequete,ConnexAdmin
    		If Not RsCongres.Eof Then
    %> 
    			Cochez ou décochez les titres selon que vous souhaitez ou non les inclure dans la sélection.<br>Pour voir la fiche descriptive d'un congrès, cliquez sur son intitule
    </font>
     
    			<table width="100%" border="0" bordercolorlight="#FFFFCC" cellspacing="3" cellpadding="0" style="border-collapse: collapse">
    				<tr>
    					<td width="2%" bgcolor="#FFFFCC"><b><font color="#FF0000">&nbsp;</font></b></td>
    					<td width="58%" bgcolor="#FFFFCC"><b><font color="#FF0000">intitule</font></b></td>
    					<td width="10%" bgcolor="#FFFFCC"><b><font color="#FF0000">Ville</font></b></td>
    					<td width="10%" bgcolor="#FFFFCC"><b><font color="#FF0000">Du</font></b></td>
    					<td width="10%" bgcolor="#FFFFCC"><b><font color="#FF0000">Au</font></b></td>
    				</tr>
    			<form name="SELECTION" method="get" action="Votre_Selection.asp">
    <%		
     
     
    			indx=0
    			While Not RsCongres.Eof
    				indx=indx+1
    				strRequete="SELECT * FROM Tbl_SelectionMonCompte WHERE numero_Congres=" & RsCongres("Id_num") ',' id_Code='" & Session("user") & "'"
    				Set RsSelection=Server.CreateObject("ADODB.Recordset")
    				RsSelection.Open strRequete,ConnexAdmin
    				If Not RsSelection.Eof Then
    					Numero_Inscription=RsCongres("Id_num")
    				Else
    					Numero_Inscription=0	
    				End If
    				Set RsSelection=Nothing
     
    				varChaine=Rtrim(RsCongres("debut_congres"))
    '				varMonth=cInt(Mid(varChaine,4,2))
    '				varYear=cInt(Mid(varChaine,7,4))
    				varMonth=Mid(varChaine,4,2)
    				varYear=Mid(varChaine,7,4)
     
    				If varMonth>=varMois And varYear>=Year(Now) Then
    %>					
    						<tr>
    							<td width="2%" bgcolor="#FFFFFF">
    							<%If Numero_Inscription=RsCongres("Id_num") Then%>
    	                            <input type="checkbox" name="cb_Congres" value="<%=RsCongres("Id_num")%>" checked style="color: #0000FF;border-style: solid; border-width: 1; background-color: #FFFFFF"></td>
    							<%Else%>
    	                            <input type="checkbox" name="cb_Congres" value="<%=RsCongres("Id_num")%>" style="color: #0000FF;border-style: solid; border-width: 1; background-color: #FFFFFF"></td>
    							<%End If%>								                            
     
    <%
    							If indx mod 2 Then
    %>						
    								<td width="58%" bgcolor="#FFFFFF"><a href="selection_congres.asp?Individuel=Oui&specialite=<%=Request.Querystring("specialite")%>&pays=<%=Request.Querystring("pays")%>&Ville=<%=Request.Querystring("Ville")%>&Mois=<%=Request.Querystring("Mois")%>&numCongres=<%=RsCongres("id_num")%>&modeAff=LaFiche"><font color="black"><%=RsCongres("intitule")%></font></a><font color="black">&nbsp;</td>
    								<td width="10%" bgcolor="#FFFFFF"><font color="black"><%=RsCongres("Ville")%></font>&nbsp;</td>
    								<td width="10%" bgcolor="#FFFFFF"><font color="black"><%=RsCongres("debut_congres")%></font>&nbsp;</td>
    								<td width="10%" bgcolor="#FFFFFF"><font color="black"><%=RsCongres("fin_congres")%></font>&nbsp;</td>
    <%
    							else
    %>								
    								<td width="58%"><a href="selection_congres.asp?Individuel=Oui&specialite=<%=Request.Querystring("specialite")%>&pays=<%=Request.Querystring("pays")%>&Ville=<%=Request.Querystring("Ville")%>&Mois=<%=Request.Querystring("Mois")%>&numCongres=<%=RsCongres("id_num")%>&modeAff=LaFiche"><font color="black"><%=RsCongres("intitule")%></font></a><font color="black">&nbsp;</td>
    								<td width="10%"><font color="black"><%=RsCongres("Ville")%></font>&nbsp;</td>
    								<td width="10%"><font color="black"><%=RsCongres("debut_congres")%></font>&nbsp;</td>
    								<td width="10%"><font color="black"><%=RsCongres("fin_congres")%></font>&nbsp;</td>
    <%
    							End If
    %>
     
     
    						</tr>
    <%
    				End If	
    				indice=indice+1
    				RsCongres.MoveNext
    			Wend
    %>
    				<tr>
    					<td colspan="5" width="100%">&nbsp;</td>
    				</tr>
    				<tr>	
    					<td colspan="5" width="100%" align="center">
                        <input type="submit" name="Action" value="Valider la sélection">&nbsp;<input type="submit" name="Action" value="Retour à la liste"></td>
    				</tr>
    			</form>

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. créer une hashmap pour chaque élément d'une liste
    Par lealeblanc dans le forum Collection et Stream
    Réponses: 3
    Dernier message: 30/05/2015, 16h23
  2. [MySQL] Créer une section pour chaque valeur d'une colonne
    Par helrick dans le forum PHP & Base de données
    Réponses: 5
    Dernier message: 14/08/2013, 00h23
  3. Comment créer des variables pour chaque ligne d'une table
    Par Slyvore dans le forum Développement de jobs
    Réponses: 4
    Dernier message: 24/04/2012, 14h24
  4. Réponses: 4
    Dernier message: 14/10/2011, 16h18
  5. [MySQL] Créer un enregistrement pour chaque ligne d'une zone de texte
    Par JackBeauregard dans le forum PHP & Base de données
    Réponses: 1
    Dernier message: 13/09/2009, 20h14

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo