Jump to content

Recommended Posts

Hi,

 

I have a little script that shows a user or group of users' work based on branches and users.

 

I.e, I would like all the users of a given branch to be able to see all the other users' things who are in the same branch only.

 

But all I'm getting is far too many results (takes a long time to load!) not in any consistent format.

 

I have tried using GROUP BY etc but with no luck, I just get different crazy results.

 

$result = mysql_query("SELECT enquiries.*, users.*
					  FROM enquiries, users
					  WHERE enqState = 'New'
					  AND users.branch = '$userBranch'
					  AND enquiries.assignedToT = users.userName
					  OR enqState = 'New'
					  AND '$userLevel' > 4
					  ") ;

Link to comment
https://forums.phpfreaks.com/topic/234218-drawing-from-multiple-tables-problem/
Share on other sites

Thanks, I know I'm just being lazy  :shy:, will optimise it once I have it working.

 

users has this structure:

 

id userName userPass     branch

 

Enquiries has:

 

id detail_sheetRef assignedToT enqState

 

I'm not to well versed on JOIN, how would that help in this case?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.