Page 1 of 1

dynamic redirect loop

Posted: Fri Mar 06, 2009 5:34 am
by Frankhouse
Hi i hope someone could help me. i have been trying to do this for a few days now, i'm a noob.

What i want to do is a php redirect that increments everytime its loaded. I have say 50 websites and i want to run 1 ad on adwords and when the ad is loaded the next website in the loop will show. I have a database with the websites its just i'm not sure how to increment the recordset query everytime.

This is what i have so far.

Code: Select all

 
<?php require_once('Connections/solutionxlocal.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
mysql_select_db($database_solutionxlocal, $solutionxlocal);
$query_Recordset1 = "SELECT website FROM wheel";
$Recordset1 = mysql_query($query_Recordset1, $solutionxlocal) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
 
$url_add = $row_Recordset1['website'];
?>
<?php
header("Location:". $url_add); 
exit;
 
mysql_free_result($Recordset1);
?>
I would appreciate any help.

Thanks
Frank