Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

allowing users to update their records only

New Here ,
Dec 29, 2009 Dec 29, 2009

I have created a login page with a drop down list of different companies. Below it I have a username and password field and a submit button. I have the behavior for a login set pointing to the mysql databases username and password fields. The database is set up with each companies specific iformation(name, address, etc) I also have a username and password fields. My thoughts were to pass the drop down of the company name to the results page. When I type in the username and password and select the company name associated with the username and password and hit submit, it verifies the username and password as supposed to, but the company name information is not passed to the results page. Any ideas on this?

If there is a better way of allowing users to modify their records?

Thanks!

TOPICS
Server side applications
621
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 30, 2009 Dec 30, 2009

Assuming you are using the PHP Log In User server behavior in Dreamweaver, a session variable called $_SESSION['MM_Username'] is created upon successful login, and is available on all pages that use the Restrict Access to Page server behavior. You can use this session variable to create a recordset on the landing page as described in the following item: http://forums.adobe.com/thread/41743.

Instead of using the recordset to display the user's name, use it to retrieve the details of the company associated with that user, and store the details in session variables. You can then use that information to ensure that the logged-in person updates only information associated with that company.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 30, 2009 Dec 30, 2009

I don't think that thread listed is correct, do you have the correct thread?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 30, 2009 Dec 30, 2009

For some reason, the final digit was deleted from the thread number. It should be http://forums.adobe.com/thread/417437.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 30, 2009 Dec 30, 2009

Ok here is what I am getting:

The log in page works fine.

The landing page, I have created a recordset with a filter of username, =, session variable, mm_username.

When I test the recordset, it ask for username, and I input a valid username and it only displays the information associated with that user. But when I try and use it live on the server, it is not passing the session variable to the landing page. I have a table set up with the companies info dynamically input from the recordset.

website is http://www.boatatlanta.com/modifymembers.php

username lakeside

paswd lake

Thank you for all of your help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 31, 2009 Dec 31, 2009

Showing me a page on a live server serves only one purpose: to prove that it's not working. But PHP is a server-side language. All the PHP code remains on the server, so it gives me no clue as to why it's not working.

Judging from what you have shown me, it looks as though you want to display the company details in an update form straight away. In that case, you need to create a SQL query that selects the company details for the username that matches the value stored in MM_Username. Since I have no idea what your database structure looks like this is purely a guess, but you will need to create this query in the Advanced mode of the Recordset dialog box:

SELECT * FROM users, companies

WHERE username = var1

AND users.company_id = companies.company_id

Click the plus button for Variables, and set the Name field to var1, Type to Text, Default value to -1, and Runtime Value to $_SESSION['MM_Username'].

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 31, 2009 Dec 31, 2009

Thank you for being so helpful. I am relatively new to this and have racked my brain for 3 days trying to figure this out.

the database is setup with the following info:

table name is members

fields are:

Field Type Collation Attributes Null Default Extra Action
int(4)Noauto_increment
textutf8_general_ciNo
textutf8_general_ciNo
textutf8_general_ciYesNULL
textutf8_general_ciNo
textutf8_general_ciNo
textutf8_general_ciNo
textutf8_general_ciNo
textutf8_general_ciNo
textutf8_general_ciNo
textutf8_general_ciNo
textutf8_general_ciYesNULL
textutf8_general_ciYesNULL
textutf8_general_ciYesNULL
textutf8_general_ciYesNULL
textutf8_general_ciYesNULL
textutf8_general_ciYesNULL
textutf8_general_ciYesNULL
textutf8_general_ciYesNULL
textutf8_general_ciYesNULL
textutf8_general_ciYesNULL
textutf8_general_ciYesNULL
textutf8_general_ciYesNULL
char(1)utf8_general_ciNoN
char(1)utf8_general_ciNoN
char(1)utf8_general_ciNoN
char(1)utf8_general_ciNoN
char(1)utf8_general_ciNoN
char(1)utf8_general_ciNoN
char(1)utf8_general_ciNoN
char(1)utf8_general_ciNoN
varchar(20)utf8_general_ciYesNULL
varchar(10)utf8_general_ciYesNULL
char(1)utf8_general_ciNoN
char(1)utf8_general_ciNoN
char(1)utf8_general_ciNoN

my sql statement is the following:

SELECT *
FROM members
WHERE members.username = Var1

Var1 is set as text, -1, $_Session['M_Username']

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 31, 2009 Dec 31, 2009

Given that database setup, it should work (although the session variable is $_SESSION['MM_Username']. PHP is case-sensitive. $_Session won't work.

If you're getting the correct results, from the recordset, you then need to bind each result to the value attribute of the update form fields.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 31, 2009 Dec 31, 2009
LATEST

On a different subject, why are you using text data types for simple character data? I'm not real familiar with MySQL, but I think the storage requirements for the text are greater than varchars and have different indexing requirements.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines