php - Session array only echoes last element -


i have session variable store array:

$outputs = array(); while($row = mysql_fetch_array($query)) {      $_session['row_id'] = $row['id'];     $outputs = $row['sport_ime'].' '.$row['sezona'].'<a href=../view/modifikacije.php> edit</a><br>';     $_session['output'] = $outputs;  } 

and on page call variable:

$outputs = $_session['output']; echo ($outputs);  

it echoes 1 row. last entry in database.

why doesn't echo everything?

try this

$_session['row_id'][] = $row['id']; $_session['output'][] = $outputs; 

please read php arrays, , consult manual when you're stuck.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -