How can I do the following in PHP?

Hi,

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: example.com/FHF73H

The DB is setup as such;

    email_id 	email 	 	 	code 	 	ts
    1 	 	test1@test.com 	 	98VIB15 	2011-03-17 01:52:22
    2 	 	test2@test.com 	 	412395D 	2011-03-17 01:58:00
    3 	 	test3@test.com 	 	6521298 	2011-03-17 02:00:51
    4 	 	test4@test.com 	 	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

$_GET['_url'];

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: http://pastebin.com/xxHNXrUv

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.