2017-10-03 2 views

答えて

0

をすべての製品を選択する]をクリックしたときにリンクするテーブルに

$sql = 'SELECT categorie.id,name,username FROM categorie,user 
     where user.id = categorie.added_by '; 
$result = $mysqli->query($sql); 
?> 

<table class="data-table"> 
    <h1>Categorie List<h1> 
    <thead> 
     <tr> 
      <th>Id</th> 
      <th>Username</th> 
      <th>Added By</th> 
     </tr> 
    </thead> 
    <tbody> 
     <?php 
     if($result == false)echo "errrrr"; 
     else{ 
      while ($row = mysqli_fetch_array($result)) 
      { 
       echo '<tr> 
       <td>'.$row['id'].'</td> 
       // here i want link <a> when click go to other page and 
       // select all products in this categorie 
       <td>'.$row['name'].'</td> 
       <td>'.$row['username'].'</td> 

       </tr>'; 

      } 
     } 
     ?> 
    </tbody> 
</table> 

倍数になる可能性があるためにそれを行うにはこのようなもの:

... 
<td><a href="otherpage.php?categorie='.$row['id'].'">'.$row['name'].'</a></td> 
... 

otherpage.phpで、カテゴリIDを$_GET['categorie']から取得できます。

関連する問題