Forums
This topic is locked
Edit Record Server Behaviour Problem
Posted 12 Sep 2003 18:04:41
1
has voted
12 Sep 2003 18:04:41 Simon Comfort posted:
HiI have looked on your site for info covering my problem but I couldn't
find
any. Here it is:
I am using DWMX with the pre-made Login, Logout and Restrict access to
page
server behaviours (for PHP). However, when I try to make a page to allow
users to edit their info (from a MYSQL database), or add a recordset
into
the page to show the user's name, it always shows the first record in
the
database, regardless of which user is signed in. Can you please tell me
a
way to filter the recordset so it shows the user who is actually logged
in
at the time?
Thanks a lot
Replies
Replied 19 Sep 2003 15:50:42
19 Sep 2003 15:50:42 Moazam Baig replied:
Hi!
I am not sure if you could use User Authentication method with the PHP server model. Since you have mentioned that you are using it here is how to filter the record.
When you are writing the query to retreive the record, use Session variable to filter. Session variable is created when the user logs in and is available on that browser only. Here is what you should write.
Runtime value: Session(MM_Username)
MM_Username is the session variable name which is generated when you use the prebuilt MMX User Login behaviour. Hope this helps.
I am not sure if you could use User Authentication method with the PHP server model. Since you have mentioned that you are using it here is how to filter the record.
When you are writing the query to retreive the record, use Session variable to filter. Session variable is created when the user logs in and is available on that browser only. Here is what you should write.
Runtime value: Session(MM_Username)
MM_Username is the session variable name which is generated when you use the prebuilt MMX User Login behaviour. Hope this helps.
Replied 19 Sep 2003 17:19:18
19 Sep 2003 17:19:18 Simon Comfort replied:
Hi
Thanks a lot for your help. You are right, there is no PHP User Authentication behaviour be default but I am using PHAkt for Dreamweaver.
Thanks Again,
Simon
Thanks a lot for your help. You are right, there is no PHP User Authentication behaviour be default but I am using PHAkt for Dreamweaver.
Thanks Again,
Simon
Replied 20 Sep 2003 00:36:04
20 Sep 2003 00:36:04 Moazam Baig replied:
Hi!
You can still use the solution I gave to retrieve the record. Just check what is the the Session variable name generated by the program you are using. Once you have got that then do this:
Query:
SELECT * FROM TABLE WHERE userName = variableName (e.g. usrName)
In the advance section of the query builder there is a section saying variable in that do this:
Name: usrName
Default: put 1 there so that it doesn't retrieve any records on its own
Run-Time value: Session(session variable name).
Thats it, it will work. If you still face any difficulty then paste the code where you used the login behaviour, I will try to help more.
You can still use the solution I gave to retrieve the record. Just check what is the the Session variable name generated by the program you are using. Once you have got that then do this:
Query:
SELECT * FROM TABLE WHERE userName = variableName (e.g. usrName)
In the advance section of the query builder there is a section saying variable in that do this:
Name: usrName
Default: put 1 there so that it doesn't retrieve any records on its own
Run-Time value: Session(session variable name).
Thats it, it will work. If you still face any difficulty then paste the code where you used the login behaviour, I will try to help more.
Replied 20 Sep 2003 11:32:44
20 Sep 2003 11:32:44 Simon Comfort replied:
Thanks it works! It even worked using the first code that you gave me.
Replied 20 Sep 2003 16:16:52
20 Sep 2003 16:16:52 Moazam Baig replied:
Great! good to hear that.
Cheers,
Moazam
Cheers,
Moazam