ho provato così perchè erano sbagliati i percorsi.. ma non funziona neanche

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/";

if (
is_dir($dir)) {

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

            
$filetype substr($row_photo,-3);
            
$filetype strtolower($filetype);
                        
            if (
$filetype == "jpg" || $filetype == "gif") { ?>
    <pic>
        <image>admin/photos/uploads/thumbs/tn_<? echo $row_photo['location']; ?></image>
        <caption>tn_<? echo $row_photo['location']; ?></caption>
    </pic>
    <?
    
}else
        print    
'<center>[img]admin/photos/uploads/thumbs/tn_noimage.jpg[/img]

'
;
        
?>
<?            
            
}
        }
        
closedir($dh);
    }
}
?> 
</images>