PDA

View Full Version : Clickthrough list


infidelguy
10th November 2004, 05:34 PM
I'd like to encourage my affiliates to kind of compete with each other.

I'd like to have a page that shows "in order" the person with the highest clickthrough rate along with the results.

I modified the free script slightly, to focus on clickthroughs rather than actual sales. I give my affiliates .02 per clickthrough.

The Code in question is here:


<?
include "../affconfig.php";
include "./lang/$language";
include "header.php";

mysql_connect($server, $db_user, $db_pass)
or die ("Database CONNECT Error (line 20)");
$result = mysql_db_query($database, "SELECT * FROM `clickthroughs` WHERE 1")
or die ("Database INSERT Error");

echo "<font face=arial>Total Amount to be Paid Out: </font>";
echo "$";
print mysql_num_rows($result) * .02;
echo "[/B] so far.


</P>";
{
}

mysql_connect($server, $db_user, $db_pass)
or die ("Database CONNECT Error (line 20)");
$result = mysql_db_query($database, "SELECT * FROM `affiliates` WHERE 1")
or die ("Database INSERT Error");

if (mysql_num_rows($result))
{
print "<font face=arial><TABLE border=1 cellspacing=0 cellpadding=3>";
echo "<TR><TH>MEMBERS</TH><TH>TOTALS</TH>";
while ($qry = mysql_fetch_array($result))
{
print "<TR>";
print "<TD><font size=2>";
print $qry[refid];
print "</TD>";
print "<TD><font size=2>";

n print mysql_num_rows($result);
print "</TD>";
print "</TR>";
}
print "</TABLE>";
}

include "footer.php";
?>


I'd like the second column in the table to list the totals of each "refid". I'm sure there's some combine function, but I'm just a newbie.

Please help.

If the admin helps, of course he'll receive a nice donation for the assistance. $20.00.

Thanks. Oh, my affiliate program is here: http://www.infidelguy.com/user

infidelguy
10th November 2004, 06:29 PM
Well, with the help of a friend, I fixed it.

Here's a smaple of the code for archival purposes:


<?
include "../affconfig.php";
include "./lang/$language";
include "header.php";

mysql_connect($server, $db_user, $db_pass)
or die ("Database CONNECT Error (line 20)");
$result = mysql_db_query($database, "SELECT * FROM `clickthroughs` WHERE 1")
or die ("Database INSERT Error");

echo "<font face=arial>Total Amount to be Paid Out: </font>";
echo "$";
print mysql_num_rows($result) * .02;
echo "[/B] so far.


</P>";
{
}

mysql_connect($server, $db_user, $db_pass)
or die ("Database CONNECT Error (line 20)");
$result = mysql_db_query($database, "SELECT refid, COUNT(refid) AS clickthroughs FROM clickthroughs GROUP BY refid ORDER BY clickthroughs DESC")
or die ("Database INSERT Error");

if (mysql_num_rows($result))
{
print "<font face=arial><TABLE border=1 cellspacing=0 cellpadding=3>";
echo "<TR><TH>MEMBERS</TH><TH>TOTALS</TH>";
while ($qry = mysql_fetch_array($result))
{
print "<TR>";
print "<TD><font size=2>";
print $qry[refid];
print "</TD>";
print "<TD><font size=2>";
$total = $qry[clickthroughs] * .02;
print round($total, 2);
print "</TD>";
print "</TR>";
}
print "<
/TABLE>";
}

include "footer.php";
?>