Jump to content

Redirect on qualifer


Tony808

Recommended Posts

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? :)

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/283899-redirect-on-qualifer/
Share on other sites

Thank you. 

 

Maybe I was not clear. I want to replace the URL that is created by this statement:

 

$link[]     = 'index.php?id='.$row['fld_main_link_id'].'&ss='.$row['fld_ss'].'&'.$row['fld_link'];//$row['fld_link']

 

with another web address, for example somesite.com

 

I thought that this would work:

 

if catArray[] = 4 $link[] = 'http://somesite.com';

 

but I end up with this error: Parse error: syntax error, unexpected T_STRING, expecting '(' in /home/moc/public_html/nav.php on line 26

 

Line 26 is the line I added.

 

Here is the code I am working with, with my line added at the end:

 

sql = "SELECT * FROM tbl_main_links ORDER BY fld_main_link_id";
  #### Query 1 MAIN LINKS ####
                    $sql = "SELECT * 
                    FROM tbl_main_links ml
                    WHERE ml.fld_status ='1'
ORDER BY ml.fld_sort ";
$result = mysql_query($sql, $db_connection) or die(mysql_error());
$catArray = array(); 
                    $name     = array();
                    ## fetch an array ##
                    while ($row = mysql_fetch_assoc($result)):
                    
                    ## 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']
 
if catArray[] = 4 $link[] = 'http://somesite.com';
 
Thanks in advance for any assistance!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.