LoginSignup
0
3

More than 5 years have passed since last update.

GETでIDを渡す方法

Posted at

GETでIDを渡す方法

今回使ったコード
商品一覧ページから商品詳細ページへGETでIDを取得してページへ移動

qiita.rb

//SELECT
<?php $stmt=$db->query("SELECT * FROM item WHERE id=".$_GET["id"]); ?>

//リンク先へ移動するaタグ
<?php echo "<a href='shop_item_info2.php?id=" . $row ['id'] . "'>編集</a>" ?>

 注意

$stmt=$db->queryの書き方はセキュリティ上良くないのでprepareを使うほうがいいということ。

0
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3