Jump to content

Recommended Posts

So i have a DB with a table in called 'friends' and in the table i have userID and FriendID, thus finding all the friends you would look up userID and display all of them..

 

If i have 5 friends and their names are Kyle, Joe, Bob, Dillion, and Josh.

When i go to look up my friends i want to know how to sort all those names alphabetically

Link to comment
https://forums.phpfreaks.com/topic/244340-friends-sorted-alpha/
Share on other sites

LOL at you not listening/reading correctly.

 

select * from friends f left join members m on(f.friendID = m.userID) where f.userID = 12345 order by m.firstName;

 

Can you explain to me in depth a little.. I think i understand what your doing but dont know how to implement that

Listen whiteboy, I saw your other thread and you convey a sense of denseness.  That IS what you need. 

 

A few pieces of advice; when making a thread, ask a question.  Your OP does a very poor job trying to describe your issue.  You obviously didn't even attempt to try this yourself, a simple Google search would get you well on your way.

LOL at you not listening/reading correctly.

 

You tell him girl! Teach that Maq who is boss. mmmhmmm because we all know there is nothing on the in between side of things mmhmmm. Thats how us whiteboi girls rolls you know what I am sayin to ya? mmmhmmm. Cause we always know how to read and listen mmhmmm so just tell him to talk to the hand as our faces ain't listenin (snaps fingers in a circular direction).

 

 

mmhmmmmm

Listen whiteboy, I saw your other thread and you convey a sense of denseness.  That IS what you need. 

 

A few pieces of advice; when making a thread, ask a question.  Your OP does a very poor job trying to describe your issue.  You obviously didn't even attempt to try this yourself, a simple Google search would get you well on your way.

I did a google search.. I explain in the best way possible.. its a table that has a userid and a friendid.. Thats it... How would orderby order a users name that is on a completely different table. I have more knowledge in PHP then CSS thus i would know the 'orderby'. If you were the OP and i replied with that you would of said the same thing. I didnt any way disrespect you nor anyone else. Now premiso on the other hand is...

 

And i did do a google search.. Couldnt find what i was looking for, so posting was clearly a suitable reasoning.

 

and clearly you can see my frustration when posting on here im getting answers that aren't to my understanding, especially on the CSS thread.

so the table

___friend_____

--userID-- --friendID--

________________

 

_____________users______________

--ID -- --name-- --username-- --password--

_______________________________

 

a foreach within a foreach would work but im not sure how to save all data to an array then sort that array by name then echo, but thats not a very good way of doing it.. seems fairly slow..

 

I am pretty sure the way the user 'the_little_guy' said it would make sense.. Just never seen that done, and a little more info would help..

 

A left join takes table A (as your main table) then joins table B (as your secondary table) to make one final table as the result.

 

the "ON" construct is like a where, the difference is (for this example), it is taking a field from A and matching it with a field from table B to make one row, after all the matches are found it will give you your resulting table set.

 

the "WHERE" is performed before the "ON"

A left join takes table A (as your main table) then joins table B (as your secondary table) to make one final table as the result.

 

the "ON" construct is like a where, the difference is (for this example), it is taking a field from A and matching it with a field from table B to make one row, after all the matches are found it will give you your resulting table set.

 

the "WHERE" is performed before the "ON"

 

WOW that simple.. Thanks

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.