MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 6th, 2005, 01:18 PM
davidekins davidekins is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 9 davidekins User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 54 m 31 sec
Reputation Power: 0
PHP & MySQL Logic query....

Hi,

I have a site (PHP/MySQL) that uses authentication (username/password) to allow access to content (on a 'userlevel' basis as well as name basis). That all works fine.

However I have a bit of a logic query. What I want to do is the following, in a statement:

If a users 'level' = 30, get all results from database (except for those marked 'private') unless for those marked 'private', the value of field 'ownerid' (in that or those records) is equal to the current 'userid' or is an admin userlevel. Otherwise, just display all the database item not marked 'private'

The code I have so far is:

Code:
if ($suserlevel>=30 OR $suserlevel==99)
{
$result = mysql_query("select * from table_items where item_category = $item_category AND item_userid= $suserid [....this is where I need to put the unless clause.....] ORDER by item_id DESC");
}else{

etc.
I'm really stuck...do I need to use some form of complicate JOIN command or do I need to write more if/else statements?

Kind Regards
David

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > PHP & MySQL Logic query....


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway