dejas Posted January 29, 2009 Share Posted January 29, 2009 Hi there, Can any one help? I am passing variable to store value in a session but can't store more than one value.. page1.php session_start(); $Connection=@mysql_connect("localhost","root","") or die("Database Connection Failed"); $db=mysql_select_db("abacorndb",$Connection) or die (mysql_error()); $sql="select f_id, f_name, f_description, f_price from tblfacilities"; $result=mysql_query($sql) or die("reord doesn't exist"); if($result){ while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo $row[f_name]; echo $row[f_description]; echo $row[f_price]; echo "<a href=test.php?f_id=".$row[f_id]."&price=".$row[f_price].">". Book. "</a>"; } } page2. php session_start(); $_SESSION['id']=$_GET['f_id']; echo $_SESSION['id']; I would like to know how I can store all my f_id values from the clicked link in the session['id']. Now It only stores any one f_id value. Any idea or suggestion. Please help needed urgently. Thanks. Link to comment https://forums.phpfreaks.com/topic/142944-cant-store-multiple-values-in-a-session-variable/ Share on other sites More sharing options...
Mchl Posted January 29, 2009 Share Posted January 29, 2009 Create an array in session. <?php session_start(); $_SESSION['ids'][]=$_GET['f_id']; var_dump($_SESSION['ids']); ?> Link to comment https://forums.phpfreaks.com/topic/142944-cant-store-multiple-values-in-a-session-variable/#findComment-749479 Share on other sites More sharing options...
dejas Posted January 29, 2009 Author Share Posted January 29, 2009 Thanks Mchl. Link to comment https://forums.phpfreaks.com/topic/142944-cant-store-multiple-values-in-a-session-variable/#findComment-749552 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.