How can I do the following in PHP?


I have setup a referral system, whereby a user enters their email address and can then refer a friend. The friend is given a unique url followed by a code, ie:

The DB is setup as such;

    email_id 	email 	 	 	code 	 	ts
    1 	 	98VIB15 	2011-03-17 01:52:22
    2 	 	412395D 	2011-03-17 01:58:00
    3 	 	6521298 	2011-03-17 02:00:51
    4 	 	3VJ7AB5 	2011-03-17 02:01:02

I have htaccess setup so

RewriteRule ^([a-z0-9]+)$ /index.php?_url=$1 [NC,L,QSA]

and I can then use


to get the referrer code.

For each user in the DB, I want to track:

a) A count of how many people have visited their referral link
b) A count of how many users have then gone on and subscribed (by entering their email address and submitting)
c) A comma-seperated column of the email_id’s of the users who performed b).

Essentially 3 columns are required.

A copy of the code being used can be found here:

Where must each of the above (a, b, and c) be placed in the code to function the way I’d like? I’m also unsure how to code all that up in PHP and what certain-type of column properties are required in the MySQL database.
Any help would be very much appreciated!

Thank you!

All good! Thanks :slight_smile: worked it out.