0
我需要基於php的website解決方案。我在主頁上有一個證書,其中內容應該從後端動態顯示。並且我還需要一個條件語句。如果證書從後臺獲得批准,則在主頁上顯示內容,如果沒有,則不顯示。使用條件語句顯示動態內容
的Html炫魅代碼
<aside id="home-marketing-testimonials">
<span class="section_title"><h6 style="color:#fff200; font-weight:bold;">Our Students Say it Best</h6></span>
<div class="testimonials" style="text-align:justify;">
<div class="testimonial">
<blockquote style="color:#fff;">
<?php
$nsql = mysql_query("select * from testimonials order by id desc limit 0,1");
while($nrow = mysql_fetch_array($nsql))
{
?>
<?php echo $nrow[5]; ?></a></strong>
<?php
$nrowlen = strlen($nrow[1]);
if($nrowlen > 220)
{
echo substr($nrow[1],0,220)."...";
}
else
{
echo "<div style='font-size:12px;color:yellow; margin-top:10px;'>".$nrow[1]."</div>";
}
?>
</blockquote>
<?php
}
?>
<strong class="client_identity" style="color:#fff; float:left;"><a class="test_author" href="students-testimonials.php"></a></strong>
</div>
</div>
</aside>
後端個人鑑定代碼:
<div class="content_display">
<div class="widgetcontent bordered">
<div class="row-fluid">
<!--<div align="right"><a href="add_pages.php" style="margin-bottom: 10px; color:#fff;" class="btn btn-primary">Add New</a></div>-->
<table class="table table-bordered" width="100%">
<colgroup>
<col class="con0" />
<col class="con1" />
<col class="con0" />
<col class="con1" />
<col class="con0" />
<col class="con1" />
</colgroup>
<thead>
<tr>
<th width="10%">S.No</th>
<th width="20%">Name</th>
<th width="20%">Student ID</th>
<th width="20%">Email</th>
<th width="10%">Status</th>
<th width="20%">Options</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
$sql=mysql_query("select * from testimonials order by id desc");
while($res=mysql_fetch_array($sql))
{
?>
<tr>
<td ><?php echo $i; ?></td>
<td><?php echo $res['name']; ?></td>
<td><?php echo $res['stuid']; ?></td>
<td><?php echo $res['email']; ?></td>
<td><?php
if($res['cstatus']=="0")
{
echo "Disapproved";
}
else
{
echo "Approved";
}
?>
</td>
<td>
<a href="view_testimonial.php?id=<?php echo $res['id']; ?>">View</a>
<?php
if($res['cstatus']=="0")
{
echo '<a href="approve.php?id='.$res['id'].'">Approve</a>';
}
else
{
echo '<a href="disapprove.php?id='.$res['id'].'">Disapprove</a>';
}
?>
<a href="#" onClick="ConfirmChoice(<?php echo $res['id']; ?>);">Delete</a></td>
</tr>
<?php
$i++; }?></tbody></table></div></div></div>
你有沒有看到我的網頁,如果我有三個推薦,它會改變,還是我應該在HTML頁面進行總和更改,如果有。請建議 – Zain 2014-09-29 11:50:18
現在你的最後有限制0,1,這意味着它只會顯示一個。你可以擺脫限制0,1部分,它會得到很多存在的匹配cstatus = 1 – rgbflawed 2014-09-29 11:53:37
我需要證明改變..但現在第1 testimoials只顯示 – Zain 2014-09-29 11:53:53