各インタビューの下に18のインタビューとボタンがあります。しかし、私はサイクルを台無しにして、各インタビューの下にある18個のボタンで18回のインタビューを受けました。 1つのボタンでなければなりません。PHP While Cycle
私はそれがサイクルの問題であると確信しています。私のミスはどこにあるのか教えていただけますか?ここで
が私のコードです:
<?php
$sql = "SELECT * FROM interviews WHERE featured = 1";
$featured = $db->query($sql);
?>
<div class="container">
<table class="rwd-table">
<tbody>
<br><br>
<tr>
<?php
include_once("../forum/connect.php");
$sql = "SELECT * FROM categories2 ORDER BY category ASC";
$res = mysql_query($sql) or die(mysql_error());
$interviews = "";
if(mysql_num_rows($res) > 0){
while($row = mysql_fetch_assoc($res)){
$id = $row['id'];
$category = $row['category'];
$sql2 = "SELECT * FROM interviews WHERE categories='".$id."'ORDER BY title DESC";
$res2 = mysql_query($sql2) or die(mysql_error());
if(mysql_num_rows($res2) > 0){
while($row2 = mysql_fetch_assoc($res2)){
$tid = $row2['id'];
$title = $row2['title'];
$interviews .= "<a href='view_interview.php?cid=".$id."&tid=".$tid."' class='cat_links'>".$category." - ".$title."</a>";
}
}
}
$counter = 0;
while($product = mysqli_fetch_assoc($featured)){
$image = $product['image'];
$title = $product['title'];
$decs = $product['description'];
if($counter % 3 == 0){
echo '</tr><tr>';
}
++$counter;
echo "<td>
<div id='element1'></div>
<div id='content1'>
<img src=".$image." alt=".$title.">
<h3>".$title."</h3>
<hr>
<h4>".$decs."</h4>
<div id='hovers'>
<a href='view_interview.php?cid=".$id."&tid=".$tid."' class='button' target='_blank'>
<span class='contentbut'> Read More</span>
</a>
</div>"; echo $interviews;
}
?>
<br><br>
</td>
<?php
}
?>
</tr>
</tbody>
</table>
</div>
* 18人のインタビューや各面接下のボタンを持っている:
あなたのループstructreはこのようなものです。しかし、私はサイクルを混乱させました。そして今、私は各インタビューの下の18のボタンで18のインタビューをしています*。あなたの声明は矛盾しています。 – Ravi
私は各インタビューの下にただ一つのボタンがあるべきであることを意味する。つまり、18回のインタビューと18回のボタンが必要です。 – Kaloyan
しかし、私は各インタビューの下に18のインタビューと18のボタンを持っています。それは18 * 18 = 324ボタンを意味します。 – Kaloyan