Ho questo script

Codice PHP:
<images>
<?
$dir 
"slideshow/";

if (
is_dir($dir)) {

    if (
$dh opendir($dir)) {
    
        while ((
$file readdir($dh)) !== false) {

            
$filetype substr($file,-3);
            
$filetype strtolower($filetype);
                        
            if (
$filetype == "jpg" || $filetype == "gif") { ?>
    <pic>
        <image>slideshow/<? echo $file;?></image>
        <caption><? echo $file;?></caption>
    </pic>
<?            
            
}
        }
        
closedir($dh);
    }
}
?>
</images>
dovrei sostituire la directory slideshow/ con admin/photos/uploads/thumbs/tn_". $row_photo['location']."

ho provato a fare così:

Codice PHP:
<images>
<?

    $sql 
"select * from photos where ptid = "$_REQUEST['id'] . " order by porder asc";
    
$photo mysql_query($sql,$myconn) or die(mysql_error()); 
    
    
     
// start php to load javascript slide show
    
$n " ";
    
    
$count 0;
    while (
$row_photo mysql_fetch_assoc($photo)) {
        if (
$count == 1) {
            
$captions .=$n;
            
$dir .=$n
        }
        else
            
$count $count 1;
        
$captions .= "'".$row_photo['caption']."'" ;
    
$dir "'admin/photos/uploads/thumbs/tn_"$row_photo['location']."'";

if (
is_dir($dir)) {

    if (
$dh opendir($dir)) {
    
        while ((
$file readdir($dh)) !== false) {

            
$filetype substr($file,-3);
            
$filetype strtolower($filetype);
                        
            if (
$filetype == "jpg" || $filetype == "gif") { ?>
    <pic>
        <image>slideshow/<? echo $file;?></image>
        <caption><? echo $file;?></caption>
    </pic>
<?            
            
}
        }
        
closedir($dh);
    }
}
?>
</images>
cosa sbaglio? si deve aggiungere la directory anche qui:
Codice PHP:
<image>slideshow/<? echo $file;?></image>
?