|
Alright here is the code I am using:
<?php include "db.php";
if (isset($id)){ $update = mysql_query("UPDATE affiliates SET views = views + 1 WHERE id='$id'"); $result = mysql_query("SELECT link FROM affiliates WHERE id='$id'"); $row = mysql_fetch_array($result); $afflink = $row['link']; header("Location: $afflink"); mysql_close();} ?>
And the redirection isn't working can anyone help?
|
|
|
|
Try this.
<?php include "db.php";
if (isset($id)){ $update = mysql_query("UPDATE affiliates SET views = views + 1 WHERE id='$id'"); $result = mysql_query("SELECT link FROM affiliates WHERE id='$id'"); $row = mysql_fetch_array($result); $afflink = $row['link']; header("Location: ".$afflink); mysql_close(); exit(); } ?>
|
|
|
|
|
That doesn't work either.
|
|
|
|
I never was good with header(); Wait for Yami.. he should know. =/
|
|
|
|
|
yeah... header can be a pain in the ass.. lol... i'll help in a sec... just back from work.. kinda knackered lol btw i have a simalar script (if its what i think you are doing) just using arrays for affiliate links.. if its what i think your doing then i can edit it to work with sql not arrays... i'll post it in a while EDIT: <? include('db.php');
if (isset($id)){ $sql = "UPDATE `affiliates` SET `views` = `views` + 1 WHERE `id`='$id'"; $sql = mysql_query($sql) or die(mysql_error()); }
while ($r=mysql_fetch_array($sql)) { $sqlr = "SELECT `link` FROM `affiliates` WHERE `id` = '$id'"; $sqlr = mysql_query($sqlr) or die(mysql_error()); $afflink = $r['link']; header(Location: $afflink); mysql_close(); } exit(); ?>
as i say i've just got back from work so that probally won't work lol
Last Edit: Nov 26, 2005 14:39:53 GMT by Llanilek
|
|
|
|
|
Doesn't work
|
|
|