Forums
This topic is locked
cookies or sessions ?
03 May 2002 18:21:02 fws fws posted:
Hi all,Could anyone cast any light on this for me.
I have 2 tables, lets say ...
TABLE 1
user_id
user_name
user_pass
TABLE 2
user_id
user_address
user_tel
user_fax
etc etc etc
not my real tables but should explain it.
when the user logs in I use KT_Username to get their records from table 1 with no problems.
what i cant get is the info from table 2. I would need to make a recordset that lists all the info in table 2 where the user_id is equal to the user_id field that I have collected from table 1.
Should i set a cookie or a session variable when the user arrives at the user logged in page and if so how do i do that ?
I got a copy of the cookie suite by Tim G but unfortunatly the set cookie from rset caused an error when looking for recrodsetphp.htm . I spoke to Tim about this and this is a problem caused by impakt changing the standards every now and again.
maybe i could create a new variable that is equal to the user_id field of table 1 and then filter table 2 by that. Again Ive been trying that but with no luck.
Im sure theres a simple way around this. Its all simple when you know how. Its just the knowing how that gets me.
Any help greatly appreciated.
Many thanks
Shan
UD4, Impakt 1.26, mysql, php etc etc etc
Edited by - shan on 03 May 2002 18:22:54
Edited by - shan on 03 May 2002 18:24:19
Replies
Replied 05 May 2002 00:45:46
05 May 2002 00:45:46 Tim Green replied:
Use a session variable, as the moment the user closes the browser window the session is destroyed.
To do this, at the very top of every page that needs it put:-
<?php
if (!session_is_registered("MySessionName") {
session_register("MySessionName"
}
?>
Then later when you have retrieved the information from the DB that you need to store (probably on the login page), use something like:-
<?php
$MySessionName = $recordset->Fields("ColumnName"
?>
Of course change MySessionName to a value meaningful to you. $recordset should be the name of your recordset, and ColumnName the name of the column in your Recordset that contains the value you wish to store.
Hope this helps.
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
To do this, at the very top of every page that needs it put:-
<?php
if (!session_is_registered("MySessionName") {
session_register("MySessionName"
}
?>
Then later when you have retrieved the information from the DB that you need to store (probably on the login page), use something like:-
<?php
$MySessionName = $recordset->Fields("ColumnName"
?>
Of course change MySessionName to a value meaningful to you. $recordset should be the name of your recordset, and ColumnName the name of the column in your Recordset that contains the value you wish to store.
Hope this helps.
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>