Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
I don't think that thread listed is correct, do you have the correct thread?
Copy link to clipboard
Copied
For some reason, the final digit was deleted from the thread number. It should be http://forums.adobe.com/thread/417437.
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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'].
Copy link to clipboard
Copied
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) | No | auto_increment | ||||||||||||
| text | utf8_general_ci | No | ||||||||||||
| text | utf8_general_ci | No | ||||||||||||
| text | utf8_general_ci | Yes | NULL | |||||||||||
| text | utf8_general_ci | No | ||||||||||||
| text | utf8_general_ci | No | ||||||||||||
| text | utf8_general_ci | No | ||||||||||||
| text | utf8_general_ci | No | ||||||||||||
| text | utf8_general_ci | No | ||||||||||||
| text | utf8_general_ci | No | ||||||||||||
| text | utf8_general_ci | No | ||||||||||||
| text | utf8_general_ci | Yes | NULL | |||||||||||
| text | utf8_general_ci | Yes | NULL | |||||||||||
| text | utf8_general_ci | Yes | NULL | |||||||||||
| text | utf8_general_ci | Yes | NULL | |||||||||||
| text | utf8_general_ci | Yes | NULL | |||||||||||
| text | utf8_general_ci | Yes | NULL | |||||||||||
| text | utf8_general_ci | Yes | NULL | |||||||||||
| text | utf8_general_ci | Yes | NULL | |||||||||||
| text | utf8_general_ci | Yes | NULL | |||||||||||
| text | utf8_general_ci | Yes | NULL | |||||||||||
| text | utf8_general_ci | Yes | NULL | |||||||||||
| text | utf8_general_ci | Yes | NULL | |||||||||||
| char(1) | utf8_general_ci | No | N | |||||||||||
| char(1) | utf8_general_ci | No | N | |||||||||||
| char(1) | utf8_general_ci | No | N | |||||||||||
| char(1) | utf8_general_ci | No | N | |||||||||||
| char(1) | utf8_general_ci | No | N | |||||||||||
| char(1) | utf8_general_ci | No | N | |||||||||||
| char(1) | utf8_general_ci | No | N | |||||||||||
| char(1) | utf8_general_ci | No | N | |||||||||||
| varchar(20) | utf8_general_ci | Yes | NULL | |||||||||||
| varchar(10) | utf8_general_ci | Yes | NULL | |||||||||||
| char(1) | utf8_general_ci | No | N | |||||||||||
| char(1) | utf8_general_ci | No | N | |||||||||||
| char(1) | utf8_general_ci | No | N | |||||||||||
my sql statement is the following:
SELECT *
FROM members
WHERE members.username = Var1
Var1 is set as text, -1, $_Session['M_Username']
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more