xiao Posted April 22, 2008 Share Posted April 22, 2008 is it possible? Because I need to find an easy way to cache my query results. I have this: function sessie($qry,$product){ while($rij = mysql_fetch_assoc($qry)){ $_SESSION['qryProductid'][$product] = $rij['products_id']; $_SESSION['qryProductnaam'][$product] = $rij['products_name']; $_SESSION['qryProductprijs'][$product] = $rij['products_price']; } } If that works, how do I transform this? (old query result output) while($rij = mysql_fetch_array($qry)) { $prijs = number_format($rij['products_price'],2, ',', ''); echo "<option value=\"" . $rij['products_id'] . " - " . $prijs . "\""; if($_SESSION['productid'][$productsoort] == $rij['products_id']) echo " SELECTED "; echo ">" . $rij['products_name'] . " - €" . $prijs . "</option>\n"; } Link to comment https://forums.phpfreaks.com/topic/102428-store-query-results-in-session-variable/ Share on other sites More sharing options...
Spaceman-Spiff Posted April 23, 2008 Share Posted April 23, 2008 You just need to transform it depending on the array keys. If you're not sure what they are, you can use print_r($_SESSION); or vardump($_SESSION); to check. Link to comment https://forums.phpfreaks.com/topic/102428-store-query-results-in-session-variable/#findComment-524559 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.