[eluser]flyenig[/eluser]
Hello
well I'm trying to create some type of friend request system, or friends ssystem, or users system or profile system,(what ever u want to call it :-P).
for example...(send friend request, accept friend request, block user, send comment, messaging between friends, etc)
Ive looked almost everywhere and i cant seem to find a tutorial.
Any help would be appreciated.
thank you
[eluser]freshface[/eluser]
There are no tutorials for doing this.
Just learn the code igniter basics.
[eluser]flyenig[/eluser]
thanks,
well i know the basics, i just need help on how to start this,
ive already created views for it.
like how would i go about this, in the database
[eluser]bretticus[/eluser]
[quote author="flyenig" date="1254004455"]thanks,
well i know the basics, i just need help on how to start this,
ive already created views for it.
like how would i go about this, in the database[/quote]
Programming = Trial & Error = Time consuming = Experience.
My point, you can teach yourself much by just digging in and doing it.
Suggestion: Ask more specific questions including what you have attempted and ask them one at a time.
[eluser]flyenig[/eluser]
Thx
Ok well,
I've tried and failed and ive been trying to do this for a week straight, and the code i had before, i started all over because nothing was working at all. so right now, all i have is my views and some mysql
and i see what you are saying,
So to simplify this,
How would i acheive a simple friend request system?
for example, Kenny sends a friend request to Jake, Jake accepts and they become friends.
and i can view all of johns friends
(and no im not a beginner with codeigniter :-P)
[eluser]freshface[/eluser]
For doing this you need to know how the db class works and how relationships work.
[eluser]flyenig[/eluser]
lol, yea i know how the DB class works, i've made a CRUD already from scratch, I've made it so that people can have a profile, and edit their information and settings, and also people can view all the users thats on my site. (using num_rows etc...)
I have some knowledge on relationships,
an example of how i could go about this would be nice, and i think i can handle the rest.
[eluser]bretticus[/eluser]
[quote author="flyenig" date="1254005029"]How would i acheive a simple friend request system?
for example, Kenny sends a friend request to Jake, Jake accepts and they become friends.
and i can view all of johns friends[/quote]
That is not a specific question: How would I achieve a simple friend request system? So here's my broad and overarching answer:
Store Kenny's friend request in the database. When Jake logs in, display that he has a request. Let Jake accept or deny the request and store that in the database so when Kenny logs in he can see Jake's profile.
See how that works?
[eluser]flyenig[/eluser]
[quote author="bretticus" date="1254006319"]
Store Kenny's friend request in the database. When Jake logs in, display that he has a request. Let Jake accept or deny the request and store that in the database so when Kenny logs in he can see Jake's profile.
See how that works?[/quote]
Yes thats what i need help with. im having a hard time coding that out.
if i can see an example from someone that would be nice
[eluser]ChrisMiller[/eluser]
Code: CREATE TABLE IF NOT EXISTS `friend_requests` (
`rid` int(11) NOT NULL auto_increment,
`sender` int(11) NOT NULL,
`recipient` int(11) NOT NULL,
PRIMARY KEY (`rid`))
ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `members` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(255) NOT NULL,
`friends` text NOT NULL,
PRIMARY KEY (`id`))
ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `relationships` (
`rid` int(11) NOT NULL auto_increment,
`user_ida` int(11) NOT NULL,
`user_idb` int(11) NOT NULL,
`type` int(1) NOT NULL,
PRIMARY KEY (`id`))
ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
Okay the quick and dirty explanation... this is not a perfect setup nor the best but it works and should help you get you on the right track. So you have a bunch of members in the member table.
User A decides to add User B as a friend so the request is sent and a row is created in the friend_requests table. If User B accepts it then a new row is created in relationships table and would contain User A's ID# & User B's ID # and the type of relationship for basic we will use 1 however you can set 2 to be family and so on as needed. Then to get a list of friends you would query the relationship table for anywhere that the user_a or user_b id ='s the users friend list you are trying to find and then you will get a list of ID's. I reccommend getting a book on MySQL to learn how to do complex queries such as Sub Queries etc...
|