View Full Version : $_GET + MySQL [Visitors/Referred]

02-02-2010, 10:13 PM
OK. Pretty much I am looking for a tutorial on taking a variable in the browser, (EX: google.com?r=123) and adding 1 (Yes, like the number) to 123's referral count. If anyone can direct me on how to do that, that'd be wonderful :)

ALSO, is there a way where we can do it with a line of code simply like:

$referrals[123] = ++;
Or something? So the user has to do something for it to go up?


02-02-2010, 10:17 PM
yes, you can use HTTP_REFERER:


then you'll need to parse the query string to get the data, at that point you should be able to increment the number like:


02-02-2010, 10:18 PM
It's as easy as $_GET['r']++. Now, if you want that new number to show up in the URL, you'll need to reload the page. You can do this with a header("Location:URL"), but you'll need to format the query string yourself. You can also use a form with method="GET", then use a hidden input element to handle the the new number.

02-02-2010, 10:30 PM
ah, thanks for the spam.......

( does this ever actually work? )

02-02-2010, 10:37 PM
We're now engaged.

02-02-2010, 10:38 PM
sweet! if only I had clicked sooner! ;)