Cheap Bastard
New Member
Table:
(year month)
| simply splits the two fields of the table.
YYYYMM | 0
refcnt | ref_url
refcntref2 | ref_url2
somehow all i get is 1 referral URL with a count of 1. The YYYYMM | 0 stays there unharmed. The YYYYMM is simply there to know when to reset it.
Here's the referral part...
any clues? Probly a logical error
(year month)
| simply splits the two fields of the table.
YYYYMM | 0
refcnt | ref_url
refcntref2 | ref_url2
somehow all i get is 1 referral URL with a count of 1. The YYYYMM | 0 stays there unharmed. The YYYYMM is simply there to know when to reset it.
Here's the referral part...
PHP:
$month = date(Ym);
$sql = "SELECT refcnt FROM track0ref WHERE ref = \"0\"";
$result = @mysql_query("$sql",$dbconn);
$rowref = mysql_fetch_array($result);
$refmonth = $rowref['refcnt'];
if($refmonth == $month)
{
$sql = "SELECT refcnt FROM track0ref WHERE ref = \"$HTTP_REFERER\"";
$result = @mysql_query("$sql",$dbconn);
$rowref = mysql_fetch_array($result);
$refcnt = $rowref['refcnt'];
if($refcnt) {
$refcnt++;
$sql = "UPDATE track0ref SET refcnt = \"$refcnt\" WHERE ref = \"$HTTP_REFERER\"";
$result = @mysql_query($sql,$dbconn) or die("Couldn't update ref count");
} else {
$sql = "INSERT INTO track0ref (ref,refcnt) VALUES (\"$HTTP_REFERER\",\"1\")";
$result = @mysql_query($sql,$dbconn) or die("Couldn't insert ref values");
}
any clues? Probly a logical error