【发布时间】:2016-04-30 18:30:18
【问题描述】:
以下代码仅显示记录列表,当我们单击链接时,我希望它转到另一个页面,该页面假定仅显示所选标题的记录详细信息。目前,它总是显示相同的细节。现在只显示所选标题的记录详细信息的解决方案是什么
<table class="table table-striped table-bordered bootstrap-datatable datatable">// the record list table
<thead>
<tr>
<th>ID</th>
<th>Course Name</th>
<th>Duration</th>
<th>Subjects</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php $getcourseslist = find_all("select * from course");
while(@$getcourses = fetch_array($getcourseslist)){
?>
<tr>
<td><?= $getcourses->id; ?></td>
<td> <a href="viewcoursedetails.php"><?= $getcourses->title;?></td></a>
<td><?= $getcourses->duration/12; ?> Years</td>
<td class="center">
<?php $getsubjects= find_all("select * from subjects where courseid='$getcourses->id'");
while(@$getsubs = fetch_array($getsubjects)){
?>
<?= $getsubs->name; ?><br>
<?php } ?>
</td>
<td class="center">
<?php if($getcourses->status == 1){ ?>
<span class="label label-success">Active</span>
<?php }
else{
?>
<span class="label label-important">Blocked</span>
<?php } ?>
</td>
<td class="center">
<a class="btn btn-success" href="editcourse.php?course=<?= $getcourses->id; ?>">
<i class="halflings-icon white edit"></i>
</a>
<?php if($getcourses->status == 1){ ?>
<a class="btn btn-danger" href="disable.php?course=<?= $getcourses->id; ?>&&action=block&&page=courses">
<i class="halflings-icon white trash"></i>
</a>
<?php }
else{
?>
<a class="btn btn-danger" href="disable.php?course=<?= $getcourses->id; ?>&&action=unblock&&page=courses">
<i class="halflings-icon white trash"></i>
</a>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div><!--/span-->
</div><!--/row-->
// 下面的代码应该只显示所选标题的记录详细信息。目前,它总是显示与上一页相同的详细列表。//
课程详情查看
<tr>
<th>ID :</th>
<td><?= $getcourses2->id; ?></td>
</tr>
<tr>
<th>Course Name :</th>
<td><?= $getcourses2->title; ?></td>
</tr>
<tr>
<th>Duration :</th>
<td><?= $getcourses2->duration/12; ?> Years</td>
</tr>
<tr>
<th>Subjects :</th>
<td class="center">
<?php $getsubjects= find_all("select * from subjects where courseid='$getcourses->id'");
while(@$getsubs = fetch_array($getsubjects)){
?>
<?= $getsubs->name; ?><br>
<?php } ?>
</td>
</tr>
<tr>
<th>Monthly Fee :</th>
<td><?= $getcourses2->monthlyfee ; ?></td>
</tr>
<tr>
<th>Examination Fee :</th>
<td><?= $getcourses2->examinationfee; ?></td>
</tr>
<tr>
<th>Addmission Fee :</th>
<td><?= $getcourses2->addmissionfee; ?></td>
</tr>
<tr>
<th>Status :</th>
<td class="center">
<?php if($getcourses2->status == 1){ ?>
<span class="label label-success">Active</span>
<?php }
else{
?>
<span class="label label-important">Blocked</span>
<?php } ?>
</td>
</tr>
<tr>
<th>Actions :</th>
<td class="center">
<a class="btn btn-success" href="editcourse.php?course=<?= $getcourses->id; ?>">
<i class="halflings-icon white edit"></i>
</a>
<?php if($getcourses2->status == 1){ ?>
<a class="btn btn-danger" href="disable.php?course=<?= $getcourses->id; ?>&&action=block&&page=courses">
<i class="halflings-icon white trash"></i>
</a>
<?php }
else{
?>
<a class="btn btn-danger" href="disable.php?course=<?= $getcourses->id; ?>&&action=unblock&&page=courses">
<i class="halflings-icon white trash"></i>
</a>
<?php } ?>
</td>
</tr>
<?php } ?>
</thead>
<tbody>
</table>
enter code here
【问题讨论】:
-
好的。您有什么问题要问我们?
-
再详细一点应该会更好。更具体一些,并尝试粘贴输出内容及其外观。
标签: php mysqli data-retrieval