Page 1 of 1

redirect with php

Posted: Thu Jun 28, 2012 8:12 am
by nite4000
I am trying to have a page redirect if a setting is enabled. i have tried the meta refresh but the page keeps refreshing over and over if i could stop it after 1 time it would work. I also have tried header but i get a header error as always

Does anyone have any ideas how to use one of these to make it work.?

here is the code i am using

Code: Select all

if($sign['random_referral']=='1') { 

$sql = "SELECT username FROM members ORDER BY RAND() LIMIT 1"; 
$res = mysql_query($sql);
$row = mysql_fetch_assoc($res);
$var1 = $row['username'];
header("Location: signup.php?ref='.$var1.'");
exit;
}
anyhelp would be great

Re: redirect with php

Posted: Thu Jun 28, 2012 1:12 pm
by Christopher
What is the header error? Usually some output, often whitespace, has been output before the call to header().