我如何引用数据库中的项目到PHP页面中的链接?

问题描述 投票:0回答:1

我正在做一个预订页面,其中有多个链接可重定向到进行预订的页面。

我的数据库中的每本书的链接都会显示多次。它处于while循环中。

if(mysqli_num_rows($result_category) > 0) {
            while($row = mysqli_fetch_assoc($result_category)) {
               //... print each book then print the link to reserve
               echo "<a id=\"reservelink\" href=\"viewRes.php?id=". $isbn ."\">Reserve</a><br>";
            }
         } else {
            echo "The chosen category has no books available";
      }

我尝试为每本书href = \“ viewRes.php?id =”做以上代码。 $ isbn ...

但是当我尝试在viewRes页面上回显$ isbn时,将不会回显。有没有一种方法可以将数据库中的每个项目分配给特定的$ isbn值?在此先感谢

php html mysql
1个回答
0
投票

php?id=". $isbn ."更改为php?id=". $row['isbn'] ."

© www.soinside.com 2019 - 2024. All rights reserved.