steviecee Posted November 16, 2006 Share Posted November 16, 2006 I'm trying to work out a way to do the following, and I'm stumped! I'm querying a database and I'm using a while loop to display the data, at the end of every run through of the while loop I'm saving one of the returned fields in a session variable, to be passed to another page. The problem is that the session variable always sets itself to the value of the last run through, so it just passes one value to the next page, how can I set it up to pass all the values through? code is:[code]$result = mysqli_query($conn, "select * from pm where userToID = 'steviece'");while ($row = mysqli_fetch_array($result)){ echo "<tr>"; echo "<td>".$row['pmID']."</td>"; echo "<td>".$row['pmTopic']."</a></td>"; echo "<td>".$row['userID']."</td>"; echo "<td>"; $pmID = $row['pmID']; session_start(); $_SESSION["messID"] = $pmID; echo "<a href='viewMess.php'>View Message</a>"; echo "</td>"; echo "</tr>";}[/code]CheersSteve Link to comment https://forums.phpfreaks.com/topic/27516-problem-with-session-variable-and-while-loop/ Share on other sites More sharing options...
steviecee Posted November 16, 2006 Author Share Posted November 16, 2006 Actually the above question isn't strictly right. the session variable needs to pass the data of whatever row is selected, so if someone clicked the second row of the the table that data would be sent via the session variable ::)Cheers Steve Link to comment https://forums.phpfreaks.com/topic/27516-problem-with-session-variable-and-while-loop/#findComment-125810 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.