Hi, as title said, how to do or what are the practices to do a system, that if the user refer to a friends (up to 10), he will get rewards per person in php and mysql? Do I need to do in cookies or database? What are the required columns if using database? How to send multiple emails?
Each registered user gets a unique ID in your system. When they log in, you show them a URL that they are supposed to send to their friends. That URL contains the info on that person - i.e. "register.php?friendThatReferredMe=452".
When the friend completes the registration form, your processing code looks at the URL param of "who referred them", and based on that data, adds rewards to the relevant referrer.
Alex's solution works fine.
However, if you don't want to have the referrer's ID in your url, you can simply ask the new user to type the username of the referrer in the registration form.
And if you are concerned that people might be dishonest by entering a wrong username, personally i'd be more tempted to enter a random number in the query string !