特定のファイルIDを持つダウンロードリンクを追加する方法を教えてください。ここで特定のファイルIDを持つダウンロードリンクを追加するにはどうすればよいですか?
コードです:
//loop through results of database query and displaying them in the table
for ($i = $start; $i < $end; $i++)
{
// make sure that PHP doesn't try to show results that don't exist
if ($i == $total_results)
{
break;
}
// echo out the contents of each row into a table`
echo "<tr " . $cls . ">";
echo '<td>' . mysql_result($result, $i, 'fdesc') . '</td>';
echo '<td>' . mysql_result($result, $i, 'category') . '</td>';
echo '<td>' . mysql_result($result, $i, 'fdatein') . '</td>';
echo '<td class="blue-text text-darken-4"><strong>' . mysql_result($result, $i, 'username') . '</strong></td>';
echo '<td><a href="d1.php">Download</a></td>';
echo "</tr>";
}
**警告**:PHPを学んでいるだけの方は、古い['mysql_query']( http://php.net/manual/en/function.mysql-query.php)インターフェイス。それはひどいので、PHP 7では削除されました。[PDOは学ぶのが難しくありません](http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo- for database-access /)、[PHP The Right Way](http://www.phptherightway.com/)のようなガイドはベストプラクティスの説明に役立ちます。 **あなたのユーザーパラメータが[正しくエスケープされている](http://bobby-tables.com/php)か、重大な[SQLインジェクションバグ](http://bobby-tables.com/ )。 – tadman
このように結果を取り出す方法は、非常に非効率的で大量に冗長です。行全体を一度取り出して、そのデータを直接使用してください。 – tadman
私はそれにページングを組み込んでいるので、なぜmysql_queryを使うのですか? –