私のウェブサイト内でこれを機能させるのに問題があります。CSSに3つの列があります。最初の 2 つの列には one_third のクラスを使用し、最後の列には one_third column_last のクラスを使用しています。複数の行があります:
<div class="one_third">
<img src="images/content/about-grow.jpg" alt="" />
<h4>Grow a Garden</h4>
<p>Sed posuere consectetur est at lobortis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sed odio dui. sed.</p>
</div>
<div class="one_third">
<img src="images/content/about-wildlife.jpg" alt="" />
<h4>Protect Wildlife</h4>
<p>Sed posuere consectetur est at lobortis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sed odio dui. sed.</p>
</div>
<div class="one_third column_last">
<img src="images/content/about-volunteer.jpg" alt="" />
<h4>Volunteer</h4>
<p>Sed posuere consectetur est at lobortis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sed odio dui. sed.</p>
</div>
これが私のphpです。現在、2 つの列のみを出力しています。最後の列を正しく出力する方法がわかりません。助けてください!
<?
include("includes/connect.php");
$staff = mysql_query("SELECT * FROM programs ORDER BY title ASC");
$numrows=@mysql_num_rows($staff);
if($numrows != 0) {
while ($result_staff = mysql_fetch_array($staff)) {
?>
<?
if ($result_staff['image'] == "") {
?>
<div align="center" style="padding-bottom:2%" class="one_third">
<a href="images/content/<? echo $result_staff['image2']; ?>" class="fancybox" title="<? echo $result_staff['name']; ?>"><img src="images/content/<? echo $result_staff['image2']; ?>" alt="<? echo $result_staff['name']; ?>" border="1" /></a><br /><h4><? echo strtoupper($result_staff['title']); ?></h4><p><? echo $result_staff['content']; ?></p>
</div>
<? } else { ?>
<div align="center" style="padding-bottom:2%" class="one_third">
<a href="images/content/<? echo $result_staff['image']; ?>" class="fancybox" title="<? echo $result_staff['name']; ?>"><img src="images/content/<? echo $result_staff['image']; ?>" alt="<? echo $result_staff['name']; ?>" border="1" /></a><br /><h4><? echo strtoupper($result_staff['title']); ?></h4><p><? echo $result_staff['content']; ?></p>
</div>
<? } ?>
<? } } ?>