Jump to content

url query for two values


wkilc

Recommended Posts

Hi,

 

I've can use the following URL to filter the query below:

 

www.mysite.com?levels=PreK

...this will show me alll the PreK members.

www.mysite.com?levels=Elem

...this will show me all the Elem members.

 

How do I filter it to show both me BOTH the PreK and Elem members?

 

Do I need to change the query?

 

        WHERE ((user_info.Type LIKE '$Type%')
                and ((user_info.snr_First LIKE '%$name%')
                or (user_info.snr_Last LIKE '%$name%'))
     		and (user_info.snr_Home_phone LIKE '$snr_Home_phone%')
   		and (user_info.snre_eMail LIKE '$snre_eMail%')
   		and ((user_info.PreK LIKE '$levels%')
	or (user_info.Elem LIKE '$levels%')
	or (user_info.MS LIKE '$levels%')
	or (user_info.HS LIKE '$levels%')
	or (user_info.College LIKE '$levels%')
        or (user_info.Admin LIKE '$levels%')
                or (user_info.Prvt LIKE '$levels%')))
        	ORDER BY user_info.$sort LIMIT $eu, $limit ";
$result = mysql_query($query);

 

Thanks.

 

~Wayne

Link to comment
Share on other sites

Not without knowing the rest of the code.  I'm guessing there is a lot more going on than what you showed us there.  Your best bet is to modify the code to query the DB for multiple groups and levels instead of just levels.

Link to comment
Share on other sites

Something like this?  (I say like this... because I've done something wrong ...and this gives me an error.)

 

        WHERE ((user_info.Type LIKE '$Type%')
                and ((user_info.snr_First LIKE '%$name%')
                or (user_info.snr_Last LIKE '%$name%'))
     		and (user_info.snr_Home_phone LIKE '$snr_Home_phone%')
   		and (user_info.snre_eMail LIKE '$snre_eMail%')
   		and ((user_info.PreK LIKE '$levels%')
	or (user_info.Elem LIKE '$levels%')
	or (user_info.MS LIKE '$levels%')
	or (user_info.HS LIKE '$levels%')
	or (user_info.College LIKE '$levels%')
        or (user_info.Admin LIKE '$levels%')
                or (user_info.Prvt LIKE '$levels%'))
                and (user_info.PreK AND user_info.Elem LIKE '$primary%'))
        	ORDER BY user_info.$sort LIMIT $eu, $limit ";
$result = mysql_query($query);

 

Thanks.

 

~Wayne

 

Link to comment
Share on other sites

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.