Forum Moderators: coopster

Message Too Old, No Replies

Need help with a PHP/MySql Jump Script

         

dak142

2:50 am on Apr 6, 2004 (gmt 0)

10+ Year Member



I found the example jump script below. I undestand it, however, I am not understanding how a record number get passed into this code from a link. What would be an example of a link that would be able to pass a record number into it. The file name that this code resides in is called jump.php.

I have also read in a affiliate forum (quote below)that putting &afsrc=1 at the end of a link will help click through, how might this also be implemented?

"Recently, I put the &afsrc=1 on all my links across my largest sites. Damned if sales have not increased by 10-20% since then. (it has been about 2 weeks at about 13000 clicks a day)"

<?php

$link = mysql_connect ("localhost", "user", "pass");
mysql_select_db ("datebase");

$result = mysql_query ("SELECT link FROM id WHERE number=$locn");
$row = mysql_fetch_array($result);

header("Location: " . $row["link"]);

mysql_close ($link);
?>

DAK

jamie

6:36 am on Apr 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



dak,

that quote is VERY misleading. sales will not increase or decrease mererly by the addition of some characters on a URL :-)

however, adding tracking codes to URLs which come from certain places is a great way of tracking visitor behaviour. e.g. we append "?source=googlads.key-words" for each listing in google adwords - that way by checking our referrer logs we can tell how many people came in to our site by which keywords and what they did after that.

re the jump script. you would need a mysql table (called 'id' in this case) which relates number codes to links.
you are selecting "link FROM id WHERE number=$locn"
so your mysql table could look like this

ID ¦ link ¦ number
-------------------------
1 ¦ page1.php ¦ 10
2 ¦ page2.php ¦ 11
3 ¦ page3.php ¦ 12
4 ¦ page4.php ¦ 13

you can see that number 10 relates to page1.php, 11 to page2.php, etc, etc

you would then link to the jump script like this:
/jump.php?locn=10 which would take you to page1.php

beware that this would only work when register globals is on [php.net]. if the script doesn't work for you. try changing this line to the following:

$result = mysql_query ("SELECT link FROM id WHERE number=$_REQUEST['locn']");

sorry if i've pointed out a lot of stuff you already know :-)

good luck