Jump to content

Show 2 Values in Query


doubledee

Recommended Posts

How do I change this code...

	// Build query.
	$q3 = "SELECT requestor, username, photo_name, photo_label, requestee_approved
					FROM friend AS f
					INNER JOIN member AS m
					ON f.requestor=m.id
					WHERE requestee=?
					AND requestor_approved=1 AND requestee_approved=0";

 

...so that I can see...

					WHERE requestee=?
					AND requestor_approved=1 AND (requestee_approved=0 OR requestee_approved=2)

 

I'm not sure how to do an "OR" in SQL, and I believe there are a few ways to do it, right?

 

 

Debbie

 

 

Link to comment
Share on other sites

First rule when using OR is to use paretheses to remove ambiguity

 

Instead of

A AND B OR C

 

use

(A AND B) OR C

or

A AND (B OR C)

 

Secondly. if you have WHERE (x = 1) OR (x=2) OR (x=3) it is easier to have WHERE x IN (1,2,3)

 

Somewhat off topic, but what do you think about this from a design standpoint...

 

I have a Form/Page which displays all incoming Friend-Requests for the logged in Member.

 

There is the Requesting User's: Username, Photo, and 3 Radio Buttons ("Decide later", "Accept", Decline")

 

The way my page is coded now, when new Friend-Requests come in, everything defaults to "Decide Later".

 

If the User doesn't do anything, the next time the Form loads it will be as is.

If the User chooses "Accept" for a Requestee, then their name disappears off this Friend-Request List.

If the User chooses "Decline", the same thing happens.

 

The point is, that I have a "one trick pony" and I am wondering if I should make it so you can always see what you chose?

 

Follow me?

 

 

Debbie

 

 

Link to comment
Share on other sites

I'm assuming you can already show a list of (accepted) friends so all you would need to add is an option to list declined friend requests

 

Well, here is where maybe I didn't choose the best design...

 

In a Member's Profile, the is a "My Friends" tab which shows all "accepted" Friends, but it is read-only.

 

Then I have my "manage_requests.php" script that is supposed to just let a Member "Decide Later/Accept/Decline".

 

Once a decision is made, I don't show "Declined" people thinking you would want to see that.

 

I also don't have a way to UN-Friend people currently.  Should I?

 

 

Debbie

 

 

Link to comment
Share on other sites

Once a decision is made, I don't show "Declined" people thinking you would want to see that.

 

I don't generally care who I decline.  Most of the time it's just spammers or random people I don't care about that I decline so I couldn't care less if I ever saw there name again in some list saying who I declined.

 

I also don't have a way to UN-Friend people currently.  Should I?

 

Yes, you probably should.  Like most things in life friend statuses can change.  You don't necessarily need a separate page for this, just a button next to them on the current friends list to remove them.

 

Link to comment
Share on other sites

Once a decision is made, I don't show "Declined" people thinking you would want to see that.

 

I don't generally care who I decline.  Most of the time it's just spammers or random people I don't care about that I decline so I couldn't care less if I ever saw there name again in some list saying who I declined.

 

So you agree with me that when you click "Decline" that they should go *poof* for good, right?

 

 

I also don't have a way to UN-Friend people currently.  Should I?

 

Yes, you probably should.  Like most things in life friend statuses can change.  You don't necessarily need a separate page for this, just a button next to them on the current friends list to remove them.

 

Should my "manage_requests.php" page just be for NEW Friend-Requests? 

 

Or should I make it so New Requests appear as "Decide Later/Accept/Decline" and when you "Accept", the person stays in the list but is just marked as "Accepted", and then later if you want to "Decline" them you just click the other radio button?

 

 

Also, you say you don't care about people you "Decline" but that then you say "Friendships change", so what about someone you "Declined" becoming your Friend later?

 

Do I allow for that, and if so, how?

 

Thanks,

 

 

Debbie

 

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.