Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Remember me

Go Back   Tutorialized ForumsDatabasesMySQL

Add This Thread To:   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
Unread Tutorialized Forums Sponsor:
Old March 2nd, 2014, 03:26 AM
mnunan mnunan is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
Join Date: Mar 2014
Posts: 1 mnunan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m 56 sec
Reputation Power: 0
Filter results based on logged in user

Hello, this is my first post so I hope I have used the correct forum.........

If anyone can help with this query I would be most grateful.

I an online table and need to customise it to display only permitted information based on the user group the logged in user is assigned to. So this is my current query which shows records made by the current logged in user based on their registered email. So for instance, if I have 5 users in the 'standard' usergroup and they all create a record each, with this query they can each view their own record, what I need is if the user is in the 'advanced' usergroup, they can view their own records plus any created by the users in the 'standard' usergroup. This is on a joomla website, not sure if that makes a difference but all of the access levels are defined by the CMS and I can't have the names of the actual usergroup in the query as there will be many different ones, it needs to find the usergroup based on the email address/ID of the user who is logged in.

SELECT (CASE WHEN state = '1' THEN 'Accepted' WHEN state = '-2' THEN 'Waiting' WHEN state = '-1' THEN 'Archived' WHEN state = '0' THEN 'Rejected' ELSE 'Unknown' END) AS Status, s.names,, FROM_UNIXTIME(datetime1,'%d/%m/%y %T'), s.begin, s.PickupAddr1, s.end, s.PickupAddr4, s.message, s.selpassengers, s.selluggage, IF(s.returntrip=0, 'No', 'Yes'), IF(FROM_UNIXTIME(datetime2,'%Y') = '1970', NULL, FROM_UNIXTIME(datetime2, '%d/%m/%y %T')), tc.title AS Vehicle, s.cprice, pm.title As Payment, s.payment, s.selinfantseats, s.selchildseats, s.selboosterseats, s.selcarry,,, s.prepay, s.vehicletype FROM #__taxibooking_orders s
INNER JOIN #__taxibooking_cars tc ON = s.vehicletype
INNER JOIN #__taxibooking_paymentmethods pm ON = s.payment
WHERE = {$UserEmail}

What I need is to modify this so that the records displayed are those created by anyone in a specific user group.

The reference for who created the record is the 'email' field of the 'taxibooking_orders' table
The usergroups are defined in the 'usergroups' table
The users are defined in the 'users' table which also has an 'email' field

Thank you in advance for any assistance.

Reply With Quote

Viewing: Tutorialized ForumsDatabasesMySQL > Filter results based on logged in user

Developer Shed Advertisers and Affiliates

Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.

© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap