faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

10 of 12 people (83%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

How difficult would it be to use PHP/SQL to count when people click on an email or web link?

Feb 18th, 2003 02:39
Louis Brown, Michael Erb,


Have a table with fields: "link", "count".
Have a page that you point all of your links/emails to.
e.g.
For a "Web Link":
www.mysite.com/tracker.php?link=www.bbc.co.uk
For a "email":
www.mysite.com/tracker.php?link=mailto:[email protected]
in "tracker.php":
Do a SELECT to see if an entry for "link" already exists, if it does 
UPDATE the count by 1, if it doesn't INSERT a new record.
then redirect the browser to the "link".
header("Location: $link");
For email the browser will spawn an email dialogue from this, but its 
up to you where you actually want to send the browser to.