Précédent   Forum des professionnels en informatique > PHP > Langage > Sessions
Sessions Forum d'entraide sur les sessions avec PHP. Avant de poster -> FAQ sessions, Cours sessions et Sources sécurité
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 26/07/2006, 14h22   #1
Membre habitué
 
Avatar de scorpking
 
Inscription : avril 2006
Messages : 207
Détails du profil
Informations personnelles :
Âge : 25

Informations forums :
Inscription : avril 2006
Messages : 207
Points : 113
Points : 113
Par défaut boucle infinie je trouve pas l'erreur

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
<?php
session_start();
include ("C:\Program Files\EasyPHP1-8\php\jpgraph-1.20.4\src\jpgraph.php");
include ("C:\Program Files\EasyPHP1-8\php\jpgraph-1.20.4\src\jpgraph_line.php");
$queryid=$_SESSION['queryid'];
$count=$_SESSION['nappel'];
$nbcols=$_SESSION['nbcols'];
$query = $_SESSION['request'];
$conn = ocilogon('as_read', 'as_read.astest', 'ASTEST.ACTELION.COM'); //connection to the oracle database
$stid = ociparse($conn, $query);//prepare the query
$r = ociexecute($stid, OCI_DEFAULT);//execute the query
$ncols = OCINumCols($stid); // give the number of columns
for ( $i=0 ;$i <= $count; $i++)//$i = column number
	{
	$appel[$i]=$_SESSION["appel$i"];
	}
$count=0;
	while (OCIFetchInto ($stid, $ligne, OCI_RETURN_LOBS+OCI_RETURN_NULLS))//read one line of the answer table
	{
 
		for ( $i=0 ;$i < $count; $i++)//$i = column number
		{
			$j=$appel[$i];
			switch($i)
			{
				case 1:
				$array1[$count]=$ligne[$j] ;//write the answer in the table
				break;
				case 2:
				$array2[$count]=$ligne[$j] ;//write the answer in the table
				break;
				case 3:
				$array3[$count]=$ligne[$j] ;//write the answer in the table
				break;
				case 4:
				$array4[$count]=$ligne[$j] ;//write the answer in the table
				break;
				case 5:
				$array5[$count]=$ligne[$j] ;//write the answer in the table		
			}
		}
 
		$count++;//increase the line meter
	}
	$conn = ocilogon('query_user', 'password', 'asq');
		$query="select query_label from queries_q where query_id = $queryid";
		$stid = ociparse($conn, $query);//prepare the querie
		$r = ociexecute($stid, OCI_DEFAULT);//execute the querry
		$ncols = OCINumCols($stid); // give the number of columns
		OCIFetchInto ($stid, $ligne, OCI_NUM );//read 1 line of the result table
		$graphname=$ligne[0];
		// Creation du graphique. Ces deux fonctions sont obligatoirement utilisées
		$graph = new Graph(350,250,"auto");
		$graph->SetScale("$graphname");
		for ( $i=0 ;$i < $nbcols; $i++)//$i = column number
		{
			$j=$appel[$i];
			$j++;
			$column_name= ocicolumnname($stid, $j); // ocicolumnname return the column name
 
 
 
			switch($i)
			{
				case 1:
 
				// Creation de la courbe
				$lineplot1=new LinePlot($array1);
				$lineplot1->SetColor("blue");
 
				// Ajout de la courbe sur le graphque
				$graph->Add($lineplot1);
				case 2:
 
				// Creation de la courbe
				$lineplot2=new LinePlot($array2);
				$lineplot2->SetColor("red");
 
				// Ajout de la courbe sur le graphque
				$graph->Add($lineplot2);
				case 3:
 
				// Creation de la courbe
				$lineplot3=new LinePlot($array3);
				$lineplot3->SetColor("yellow");
 
				// Ajout de la courbe sur le graphque
				$graph->Add($lineplot3);
				case 4:
 
				// Creation de la courbe
				$lineplot4=new LinePlot($array4);
				$lineplot4->SetColor("green");
 
				// Ajout de la courbe sur le graphque
				$graph->Add($lineplot4);
				case 5:
 
				// Creation de la courbe
				$lineplot5=new LinePlot($array5);
				$lineplot5->SetColor("navy");
 
				// Ajout de la courbe sur le graphque
				$graph->Add($lineplot5);
			}
		}
// Affichage du graphique
$graph->Stroke();
?>
pour moi y'a pas d'erreur pourtant jai des notice d'index inexistant pour appel (alor qu'il sont créé et copié collé de la page précédente)
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
<?php
	session_start();
	$_SESSION['nbcols']=$_POST['glinenum'];
	$query = $_SESSION['request'];
	error_reporting(E_ALL & ~E_NOTICE);
	//$user = $_POST('user');
	//$pass = $_POST('pass');
	//$database = $_POST('database');
	$conn = ocilogon('as_read', 'as_read.astest', 'ASTEST.ACTELION.COM'); //connection to the oracle database
	$stid = ociparse($conn, $query);//prepare the query
	$r = ociexecute($stid, OCI_DEFAULT);//execute the query
	$ncols = OCINumCols($stid); // give the number of columns
	for ( $i=1 ;$i < $ncols+1; $i++)//$i = column number
	{
	$value[$i]=$_POST["value$i"];
	}
	$count=0;
	for ( $i=1 ;$i < $ncols+1; $i++)//$i = column number
	{
		if($value[$i]=='')
		{
		}
		else
		{
			$_SESSION["appel$count"]=$value[$i];
			$count++;
		}
	}
	$_SESSION['nappel']=$count;
	echo "<HTML> <head> <title>your result</title></HEAD> <BODY><FORM METHOD='POST' action='querieschoose.php4' TARGET='main'><INPUT TYPE=submit VALUE=back></FORM><TABLE BORDER=1> ";
	echo "<THEAD bgcolor=#9A9A9A>";
		for ( $i=1 ;$i < $ncols+1; $i++)//$i = column number
		{
			$column_name= ocicolumnname($stid, $i); // ocicolumnname return the column name
			echo "<TH> $column_name </TH>";
		}
		echo "</THEAD> <TBODY>";
	$count =0;
	while (OCIFetchInto ($stid, $ligne, OCI_RETURN_LOBS+OCI_RETURN_NULLS))//read one line of the answer table
	{
		echo "<TR>";
		for ( $i=0 ;$i < $ncols; $i++)//$i = column number
		{
			if(trim($ligne[$i])=="")//test if the case is null
			{
				echo "<TD><FONT color=#A0A0A0><B> (null) </B></FONT></TD>";//write null in the table
			}
				else
			{
				echo "<TD> $ligne[$i] </TD>" ;//write the answer in the table
			}
		}
		echo "</TR> ";
		$count++;//increase the line meter
	}
		echo "</table></TBODY>" ;
		//$query2 = 'select \'Query run against \'||global_name||\' and valid as of \'||to_char(sysdate,\'dd-mon-yyyy\') from global_name';
		$query2 = 'select \'Query run by \'||osuser||\' against \'||global_name||\' and valid as of \'||to_char(sysdate,\'dd-mon-yyyy\') from global_name,v$session WHERE sid = (SELECT sid FROM v$mystat WHERE rownum = 1) ';
		$stid = ociparse($conn, $query2);
		$r = ociexecute($stid, OCI_DEFAULT);
		OCIFetchInto ($stid, $ligne, OCI_RETURN_LOBS);
		echo "<TABLE BORDER=1> 
				<THEAD>
					<TH> N-Line </TH><TH> Info</TH>
				</THEAD>";
		echo	"<TBODY>";
		echo"		<TR><TD> $count </TD><TD> $ligne[0]</TD> </TR>";//post the number of line
		echo"	</TBODY>
				</TABLE>
				<a href='graph.php'>graph</A>
				<FORM METHOD='POST' action='telecharger.php' TARGET='main'><INPUT TYPE=submit VALUE=download></FORM>
				<FORM METHOD='POST' action='querieschoose.php4' TARGET='main'><INPUT TYPE=submit VALUE=back></FORM>
				</BODY>
				</HTML>";
		echo $query; //post the query after the table
		OCILogoff($conn);
?>

mais je comprend pas il n'y a aucune erreur pour moi puisque la session 'nappel' passe corectement si quelqu'un a de meilleur yeux que moi ...
scorpking est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/07/2006, 14h27   #2
Membre expérimenté
 
Inscription : avril 2006
Messages : 462
Détails du profil
Informations personnelles :
Âge : 33
Localisation : Canada

Informations forums :
Inscription : avril 2006
Messages : 462
Points : 556
Points : 556
Envoyer un message via MSN à rbaatouc Envoyer un message via Skype™ à rbaatouc
sincerement pas le courage de lire tout le code, tu peux essayer de cible la boucle qui te fait défaut stp
rbaatouc est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/07/2006, 14h27   #3
Expert Confirmé

 
Avatar de Amara
 
Inscription : juillet 2004
Messages : 2 684
Détails du profil
Informations personnelles :
Localisation : France, Sarthe (Pays de la Loire)

Informations forums :
Inscription : juillet 2004
Messages : 2 684
Points : 2 910
Points : 2 910
Encore plus de code c'est possible

C'est pourtant clair si tes index sont indéfinis bah ils sont pas définis c'est tout C'est sue les SESSION ou les POST

Mais commence par localiser le problème, et d'ailleurs c'est quoi le problème, dans le titre tu parles de boucle infinie puis d'index indéfini dans ton post
__________________
Pas de questions techniques par MP, le forum est là pour ça et est plus efficace.

Orthographe : une connexion (avec un x), un langage (sans u), une requête (un seul t), 'une quote' (avec qu), une syntaxe (sans h)
Amara est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/07/2006, 14h31   #4
Membre habitué
 
Avatar de scorpking
 
Inscription : avril 2006
Messages : 207
Détails du profil
Informations personnelles :
Âge : 25

Informations forums :
Inscription : avril 2006
Messages : 207
Points : 113
Points : 113
heu oui j'ai mis un peu beaucou de code lol
Code :
1
2
3
4
for ( $i=0 ;$i <= $count; $i++)//$i = column number
	{
	$appel[$i]=$_SESSION["appel$i"];
	}
la session appelée
Code :
1
2
3
4
5
6
7
8
9
10
11
12
$count=0;
for ( $i=1 ;$i < $ncols+1; $i++)//$i = column number
	{
		if($value[$i]=='')
		{
		}
		else
		{
			$_SESSION["appel$count"]=$value[$i];
			$count++;
		}
	}
la session créée


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
while (OCIFetchInto ($stid, $ligne, OCI_RETURN_LOBS+OCI_RETURN_NULLS))//read one line of the answer table
	{
 
		for ( $i=0 ;$i < $count; $i++)//$i = column number
		{
			$j=$appel[$i];
			switch($i)
			{
				case 1:
				$array1[$count]=$ligne[$j] ;//write the answer in the table
				break;
				case 2:
				$array2[$count]=$ligne[$j] ;//write the answer in the table
				break;
				case 3:
				$array3[$count]=$ligne[$j] ;//write the answer in the table
				break;
				case 4:
				$array4[$count]=$ligne[$j] ;//write the answer in the table
				break;
				case 5:
				$array5[$count]=$ligne[$j] ;//write the answer in the table		
			}
		}
 
		$count++;//increase the line meter
	}
c'est cette boucle elle monte a 540 alor que le max attendu est 5
scorpking est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/07/2006, 14h38   #5
Futur Membre du Club
 
Inscription : janvier 2006
Messages : 18
Détails du profil
Informations forums :
Inscription : janvier 2006
Messages : 18
Points : 15
Points : 15
Par sécurité, vérifie l'existance de la session avant de boucler:
Code :
1
2
3
4
5
 
for ( $i=0 ;  isset($_SESSION["appel$i"]) &&  $i <= $count; $i++)//$i = column number
	{
	$appel[$i]=$_SESSION["appel$i"];
	}
starn2000 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/07/2006, 14h39   #6
Membre émérite
 
Avatar de guitou12
 
Guillaume
Inscription : juillet 2006
Messages : 813
Détails du profil
Informations personnelles :
Nom : Guillaume
Âge : 29

Informations forums :
Inscription : juillet 2006
Messages : 813
Points : 905
Points : 905
Envoyer un message via MSN à guitou12
"appel$i"
__________________
Le . est la base de toute bonne concaténation, marre de voir des
echo "Mavar1 = $toto et Mavar2 = $titi";
ou pire echo 'Mavar1 = ',$toto,' et Mavar2 = ',$titi;
pratiquez plutôt le echo 'Mavar1 = '.$toto.' et Mavar2 = '.$titi;
guitou12 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/07/2006, 14h41   #7
Membre Expert
 
Inscription : janvier 2005
Messages : 1 249
Détails du profil
Informations personnelles :
Localisation : France, Gironde (Aquitaine)

Informations forums :
Inscription : janvier 2005
Messages : 1 249
Points : 1 417
Points : 1 417
Rien que ça, ça paraît très louche
Code :
$appel[$i]=$_SESSION["appel$i"];
vg33 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/07/2006, 14h44   #8
Expert Confirmé

 
Avatar de Amara
 
Inscription : juillet 2004
Messages : 2 684
Détails du profil
Informations personnelles :
Localisation : France, Sarthe (Pays de la Loire)

Informations forums :
Inscription : juillet 2004
Messages : 2 684
Points : 2 910
Points : 2 910
Citation:
Envoyé par vg33
Rien que ça, ça paraît très louche
Code :
$appel[$i]=$_SESSION["appel$i"];
En effet, il faut jouer avec des accolades pour évaluer des noms de variables.

Je crois que concatenator a fait un infarctus sur le coup
__________________
Pas de questions techniques par MP, le forum est là pour ça et est plus efficace.

Orthographe : une connexion (avec un x), un langage (sans u), une requête (un seul t), 'une quote' (avec qu), une syntaxe (sans h)
Amara est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/07/2006, 14h44   #9
Membre habitué
 
Avatar de scorpking
 
Inscription : avril 2006
Messages : 207
Détails du profil
Informations personnelles :
Âge : 25

Informations forums :
Inscription : avril 2006
Messages : 207
Points : 113
Points : 113
oui guitou "appel$i car quand je met appel[$i] dans ma session page précédente le tableau ne passe pas corectement
et maintenant j'ai plus rien du tout alor que en utilisant ça j'ai pu faire passer un autre tableau mais celui l'à ne veut rien savoir
alor a la place je fais des variable séparées
scorpking est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/07/2006, 14h46   #10
Membre émérite
 
Avatar de guitou12
 
Guillaume
Inscription : juillet 2006
Messages : 813
Détails du profil
Informations personnelles :
Nom : Guillaume
Âge : 29

Informations forums :
Inscription : juillet 2006
Messages : 813
Points : 905
Points : 905
Envoyer un message via MSN à guitou12
Code :
$appel[$i]=$_SESSION["appel$i"];
Si tu veux me faire plaisir (et faire propre) fait comme ça

Code :
$appel[$i]=$_SESSION['appel'.$i];
Mais à mon avis ton souci est ailleurs (comme la vérité )
__________________
Le . est la base de toute bonne concaténation, marre de voir des
echo "Mavar1 = $toto et Mavar2 = $titi";
ou pire echo 'Mavar1 = ',$toto,' et Mavar2 = ',$titi;
pratiquez plutôt le echo 'Mavar1 = '.$toto.' et Mavar2 = '.$titi;
guitou12 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/07/2006, 14h49   #11
Membre émérite
 
Avatar de guitou12
 
Guillaume
Inscription : juillet 2006
Messages : 813
Détails du profil
Informations personnelles :
Nom : Guillaume
Âge : 29

Informations forums :
Inscription : juillet 2006
Messages : 813
Points : 905
Points : 905
Envoyer un message via MSN à guitou12
Mais lol

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
for ( $i=0 ;$i < $count; $i++)//$i = column number
		{
			$j=$appel[$i];
			switch($i)
			{
				case 1:
				$array1[$count]=$ligne[$j] ;//write the answer in the table
				break;
				case 2:
				$array2[$count]=$ligne[$j] ;//write the answer in the table
				break;
				case 3:
				$array3[$count]=$ligne[$j] ;//write the answer in the table
				break;
				case 4:
				$array4[$count]=$ligne[$j] ;//write the answer in the table
				break;
				case 5:
				$array5[$count]=$ligne[$j] ;//write the answer in the table		
			}
		}
		
		$count++;//increase the line meter
	}
Ca serait pas le chien qui essaie de se mordre la queue sans jamais y parvenir ça ?

$i=10; $count = 11;
$i = 11; $count = 12;
$i=12; $count = 13;
....
......
__________________
Le . est la base de toute bonne concaténation, marre de voir des
echo "Mavar1 = $toto et Mavar2 = $titi";
ou pire echo 'Mavar1 = ',$toto,' et Mavar2 = ',$titi;
pratiquez plutôt le echo 'Mavar1 = '.$toto.' et Mavar2 = '.$titi;
guitou12 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/07/2006, 14h56   #12
Membre habitué
 
Avatar de scorpking
 
Inscription : avril 2006
Messages : 207
Détails du profil
Informations personnelles :
Âge : 25

Informations forums :
Inscription : avril 2006
Messages : 207
Points : 113
Points : 113
oups j'ai changé ça juste avantjvais kan meme rectifier juste
scorpking est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/07/2006, 15h02   #13
Membre habitué
 
Avatar de scorpking
 
Inscription : avril 2006
Messages : 207
Détails du profil
Informations personnelles :
Âge : 25

Informations forums :
Inscription : avril 2006
Messages : 207
Points : 113
Points : 113
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
for ( $i=1 ;$i <= $count; $i++)//$i = column number
	{
	$j=$i-1;
	$appel[$i]=$_SESSION['appel'.$i];
	}
$count2=0;
	while (OCIFetchInto ($stid, $ligne, OCI_RETURN_LOBS+OCI_RETURN_NULLS))//read one line of the answer table
	{
 
		for ( $i=1 ;$i <= $count; $i++)//$i = column number
		{
			$j=$appel[$i];
			switch($i)
			{
				case 1:
				$array1[$count2]=$ligne[$j] ;//write the answer in the table
				break;
				case 2:
				$array2[$count2]=$ligne[$j] ;//write the answer in the table
				break;
				case 3:
				$array3[$count2]=$ligne[$j] ;//write the answer in the table
				break;
				case 4:
				$array4[$count2]=$ligne[$j] ;//write the answer in the table
				break;
				case 5:
				$array5[$count2]=$ligne[$j] ;//write the answer in the table		
			}
		}
 
		$count2++;//increase the line meter
	}
voila maintenant j'ai ça mais il ne me prend toujours pas appel en session

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
for ( $i=1 ;$i < $ncols+1; $i++)//$i = column number
	{
	$value[$i]=$_POST["value$i"];
	}
	$count=0;
	for ( $i=1 ;$i < $ncols+1; $i++)//$i = column number
	{
		if($value[$i]=='')
		{
		}
		else
		{
			$_SESSION['appel'.$count]=$value[$i];
			$count++;
		}
	}
	$_SESSION['nappel']=$count;
ça je créé et 'value$i? marche trés bien

Code :
1
2
3
4
5
6
7
8
9
10
11
12
$count=$_SESSION['nappel'];
$nbcols=$_SESSION['nbcols'];
$query = $_SESSION['request'];
$conn = ocilogon('as_read', 'as_read.astest', 'ASTEST.ACTELION.COM'); //connection to the oracle database
$stid = ociparse($conn, $query);//prepare the query
$r = ociexecute($stid, OCI_DEFAULT);//execute the query
$ncols = OCINumCols($stid); // give the number of columns
for ( $i=1 ;$i <= $count; $i++)//$i = column number
	{
	$j=$i-1;
	$appel[$i]=$_SESSION['appel'.$i];
	}
et la je recupere mais appel passe pas
scorpking est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/07/2006, 15h02   #14
Expert Confirmé

 
Avatar de Amara
 
Inscription : juillet 2004
Messages : 2 684
Détails du profil
Informations personnelles :
Localisation : France, Sarthe (Pays de la Loire)

Informations forums :
Inscription : juillet 2004
Messages : 2 684
Points : 2 910
Points : 2 910
Code :
Ca serait pas le chien qui essaie de se mordre la queue sans jamais y parvenir ça ?
Excellent bien vu guitou tu es prêt à devenir manceau

__________________
Pas de questions techniques par MP, le forum est là pour ça et est plus efficace.

Orthographe : une connexion (avec un x), un langage (sans u), une requête (un seul t), 'une quote' (avec qu), une syntaxe (sans h)
Amara est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/07/2006, 15h04   #15
Membre habitué
 
Avatar de scorpking
 
Inscription : avril 2006
Messages : 207
Détails du profil
Informations personnelles :
Âge : 25

Informations forums :
Inscription : avril 2006
Messages : 207
Points : 113
Points : 113
j'ai rien dit j'ai oublier de remplacer $i par $j
mais pas de graphique bon je retourne dans la partie bibliotèque puor ça
merci a tous
scorpking est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 12h01.


 
 
 
 
Partenaires

Hébergement Web