coppens Posted October 21, 2015 Share Posted October 21, 2015 I am using Dreamweaver and would like the results of a page to display records that have the same variable as the user that has logged in. For instance, if User A works at 'Daycare A' and 'Daycare A' is coded as workplace '5'. How do I word the statement that all persons who work at workplace '5' appear on the page. The pages are already filtered to follow the user through by username. However I need the new filter to look at the users record, choose the column 'ChildcareID' and display all others from that Childcare. I currently have this statement. SELECT * FROM users WHERE ChildcareID = colname ORDER BY LastName ASC Name: colname Type: Integer Default value: -1 Run-time value: $_SESSION['MM_Username'] Thank you Quote Link to comment Share on other sites More sharing options...
thara Posted October 21, 2015 Share Posted October 21, 2015 Can you show us your database table and what do you exactly want to do? I am not clear what you are asking. Quote Link to comment Share on other sites More sharing options...
maxxd Posted October 21, 2015 Share Posted October 21, 2015 When you say you're 'using Dreamweaver', are you using it as a code editor and coding manually, or are you using the wizards and automated code generator? Quote Link to comment Share on other sites More sharing options...
coppens Posted October 22, 2015 Author Share Posted October 22, 2015 I am using the coding wizards. I want to pull the ChildcareId of the session user. The session is followed by the users 'username'. The table has UserId, UserName, ChildcareID, and UserLevel. I need the filter to look at the ChildcareID of the current user and filter all users with the same ID as well as only choosing those users with a userlevel of 1. Please help. Thank you Quote Link to comment Share on other sites More sharing options...
hansford Posted October 22, 2015 Share Posted October 22, 2015 I hated Dreamweaver 14 years ago, used it on one project which required we use it, and haven't used it since. Can't you just hand code what you need - they will never know. Quote Link to comment Share on other sites More sharing options...
Barand Posted October 22, 2015 Share Posted October 22, 2015 Assuming the data looks something like this +--------+----------+-------------+ | userid | username | childcareid | +--------+----------+-------------+ | 1 | Albert | 1 | | 2 | Betty | 2 | | 3 | Charlie | 3 | | 4 | Diane | 1 | | 5 | Edward | 2 | | 6 | Fiona | 3 | | 7 | Graham | 1 | | 8 | Helen | 2 | | 9 | Ian | 3 | | 10 | Jane | 1 | +--------+----------+-------------+ then the query you want is (if logged in user has id=1) SELECT u2.username , u2.childcareid FROM users u1 INNER JOIN users u2 USING (childcareid) WHERE u1.userid = 1 -- logged user +----------+-------------+ | username | childcareid | +----------+-------------+ | Albert | 1 | | Diane | 1 | | Graham | 1 | | Jane | 1 | +----------+-------------+ Quote Link to comment Share on other sites More sharing options...
maxxd Posted October 22, 2015 Share Posted October 22, 2015 Can't recommend enough not using the wizards. I've used DreamWeaver since before Macromedia released the studio bundle, and only used the wizards once in all that time (I keep using DW because I got used to the code coloring and, well, I already have it... Though admittedly I'm looking at different IDEs now). The pre-buit code is bloated, confusing, and badly written. I honestly think you'll be much better off hand-coding any changes you need made. Quote Link to comment Share on other sites More sharing options...
coppens Posted October 25, 2015 Author Share Posted October 25, 2015 Thank you all so much. You are amazing. Cheers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.