何らかの理由で、SQL は必要なテーブルから必要な情報を取得しません。ユーザーIDに関連付けられたフォルダーのリストをSQLから取得するためにまったく同じコードを使用し、それが正常に機能するため、これは奇妙です。したがって、URL クエリは ?o=folder&fid=0ec741fa-e708-4314-83c4-c05966a56110 のようになります。fid はフォルダー ID であり、以下のクエリはそのようなフォルダー ID に関連付けられたファイルをプルする必要がありますが、代わりに何も返されません。エラーメッセージ/コードさえありません。
構文に問題はありますか? または、問題の原因は何ですか?
修正メモ帳++で開いているタブの束があるため、間違ったコードを使用しました
SQL PDOで書かれた実際のコードは次のとおりです
require ("sql/pdo.php");
    // Lets get user's folder information
    $query = " SELECT * FROM files WHERE fid = ".$_REQUEST['fid']." "; 
    try 
    { 
        // These two statements run the query against your database table. 
        $stmt = $db->prepare($query); 
        $stmt->execute(); 
    } 
    catch(PDOException $ex) 
    { 
        // Note: On a production website, you should not output $ex->getMessage(). 
        // It may provide an attacker with helpful information about your code.  
        die("Failed to run query: " . $ex->getMessage()); 
    } 
    // Finally, we can retrieve all of the found rows into an array using fetchAll 
    $rows = $stmt->fetchAll(); 
?>
<table width="100%"> 
    <?php foreach($rows as $row): ?> 
        <tr onclick="window.location = 'file.php?fid=<?php echo htmlentities($row['id'], ENT_QUOTES, 'UTF-8')."'"> 
            <td style="width:4%;"><img src="ast/images/fs-directory.png" /></td>
            <td style="width:86%;text-align:left;"><?php echo htmlentities($row['name'], ENT_QUOTES, 'UTF-8'); ?></td>
            <td style="width:10%;text-align:center;"><?php echo htmlentities($row['privacy'], ENT_QUOTES, 'UTF-8'); ?></td> 
        </tr> 
    <?php endforeach; ?> 
</table>