SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Form to handle Friend Requests

    I am trying to come up with a way to handle Friend-Requests.

    The idea I currently have would look like this...

    Code:
    PROCESS FRIEND-REQUESTS...
    
    User1
    <user1's photo>		_ Accept  _ Decline
    
    User2
    <user2's photo>		_ Accept  _ Decline
    
    User3
    <user3's photo>		_ Accept  _ Decline
    
    User4
    <user4's photo>		_ Accept  _ Decline
    
    User5
    <user5's photo>		_ Accept  _ Decline
    
    
    	----------------------	------------
    	|  PROCESS REQUESTS  |	|  CANCEL  |
    	----------------------	------------

    Questions:

    1.) Is there a better or easier way to accomplish the same thing?

    2.) Is it possible to have a series of Accept/Decline Radio Button "pairs" on several rows in a Form?

    3.) Is it possible to make it so when the user clicks "Process Requests" that I could run an UPDATE query on each record in my "Friend" table (i.e. one Friend per record)

    Thanks,


    Debbie

  2. #2
    SitePoint Enthusiast doddsey_65's Avatar
    Join Date
    Sep 2010
    Location
    North East UK
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    I am trying to come up with a way to handle Friend-Requests.

    The idea I currently have would look like this...

    Code:
    PROCESS FRIEND-REQUESTS...
    
    User1
    <user1's photo>		_ Accept  _ Decline
    
    User2
    <user2's photo>		_ Accept  _ Decline
    
    User3
    <user3's photo>		_ Accept  _ Decline
    
    User4
    <user4's photo>		_ Accept  _ Decline
    
    User5
    <user5's photo>		_ Accept  _ Decline
    
    
    	----------------------	------------
    	|  PROCESS REQUESTS  |	|  CANCEL  |
    	----------------------	------------

    Questions:

    1.) Is there a better or easier way to accomplish the same thing?

    2.) Is it possible to have a series of Accept/Decline Radio Button "pairs" on several rows in a Form?

    3.) Is it possible to make it so when the user clicks "Process Requests" that I could run an UPDATE query on each record in my "Friend" table (i.e. one Friend per record)

    Thanks,


    Debbie
    This is just off the top of my head, but:

    Give each of the inputs an name. This is would be something like name="request[$id][]" where $id would be the database unique id for that request.

    Then you could process this in php by getting all of the ids (str_replace the "request-") and use the "IN" parameter of mysql.
    Test and help out with a new
    100% open source forum package: A Simple Forum
    Check the A Simple forum Github Page
    Visit my Github profile to see what I work on.

  3. #3
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    1: Looks good to me.
    2: Yes.
    3: Yes, but try wrapping your head around this: You should be able do all of the updating in 2 query executions, regardless of how many friends were accepted/declined.
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •