Where to place an 'if' statement to redirect

I have a SQL query that I want to qualify the output of:

build the arrays for looping through sub links

$catArray[] = $row[‘fld_main_link_id’];
$text[] = $row[‘fld_text’];
$ssL[] = $row[‘fld_ss’];
$link[] = ‘index.php?id=’.$row[‘fld_main_link_id’].’&ss=’.$row[‘fld_ss’].’&’.$row[‘fld_link’];//$row[‘fld_link’]

I want to re-write the URL based on the $catArray

for example, if catArray[] = 5 redirect to http://somesite.com

Is this possible? And if so, help? :slight_smile:


it’s possible yes, but the method will change depending on what you want to do with the rest of that data. i assume you don’t want to just drop it when you redirect, however if that is the case it’s simple.

also, I would recommend not putting the rows into non-indexed arrays. I would use a single multidimensional for all data, but at the very least give them a consistent key like $x

[php]foreach ($rows as $x => $row) {$catArray[$x] = $row[‘fld_main_link_id’];
$text[$x] = $row[‘fld_text’];
$ssL[$x] = $row[‘fld_ss’];
$link[$x] = ‘index.php?id=’.$row[‘fld_main_link_id’].’&ss=’.$row[‘fld_ss’].’&’.$row[‘fld_link’];//$row[‘fld_link’]}[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service