I have a while loop that assigns user ID's to a variable. The variable is an array. When I assign the variable to another in a link like this: it returns proper ID's on the click but only when the link is in a while loop as well. How ( is it possible ) to place the link outside the while loop and get the same ID data the variable holds ?
This code works:
while ( $row = mysqli_fetch_array($sql)) {
$variable = $row['user_id'];
echo "<a href='index.php?var=$variable'></a>";
}
This one doesn't in this case:
PHP:
while ( $row = mysqli_fetch_array($sql)) {
$variable[] .= $row['user_id'];
}
HTML:
for ($i = 0 ; $i <100 ; $i++ );
<a href='index.php?var=$variable[$i]'></a>
Thanks for comments..
<a href='index.php?var=<?=$variable[$i]?>'></a>