php - Variable does not change its value -


i have been trying analyze hours can't understand wrong code :(

$d = 1; //i declare variable 1 $a = 0; while($d<$arraycount-2){   while ($a < 40){     $c = 0;     $b = 0;      while($c < $fc){       $finaloutput = $finaloutput.$database_returned_data[$d][$c].","; //but here, in loop $d 1        $c++;     }      while($b < 5){       $finaloutput = $finaloutput.$mydata[$a][$b].",";       $b++;     }      $finaloutput = $finaloutput."--end--";     $a++;   }   $d++; //but increments successfully. hence, while loop terminates after meets criteria. } 

the variable $d 1 inside other loop increments outside loop. note there while statement inside while. there wrong?

i'm using $d array:

 $finaloutput = $finaloutput.$database_returned_data[$d][$c].","; 

i noob poster. feel free ask more details :)

you don't set $a here:

while($d<$arraycount-2){     while ($a < 40){ 

so on every iteration besides first while condition won't run.

just change to:

while($d<$arraycount-2){     $a = 0;     while ($a < 40){ 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -