2 개의 클립이있는 mysql 데이터베이스가 있습니다. 이것은 나에게 클립을 보여주는 코드입니다
if( $result = mysqli_query($con, "SELECT Widget FROM clipuri WHERE Data='$data[mday].$data[mon].$data[year]'", MYSQLI_USE_RESULT))
$row = mysqli_fetch_array($result);`
그리고 그 코드는 html로 클립을 보여줍니다.
<table border="0">
<tr><td><?php echo $row['Widget']; ?></td></tr>
</table>
해당 데이터베이스의 모든 클립을 표시하는 반복 기능을 만드는 방법은 무엇입니까?!
코드에서 while 루프를 사용해야합니다.
echo '<table border="0">';
while ($row = mysqli_fetch_array($result))
{
echo '<tr><td>'.$row['Widget'].'</td></tr>';
}//while
echo '</table>';
while 루프로 모든 행을 가져 와서 에코합니다.
연속 3 개 :
$counter = 0;
echo '<table border="0">';
while ($row = mysqli_fetch_array($result))
{
if($counter % 3 == 0)
{
echo '<tr>';
}
$counter++;
echo '<td>'.$row['Widget'].'</td>';
if($counter % 3 == 0)
{
echo '/<tr>';
}
}//while
echo '</table>';
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다