我目前正在创建一个小应用程序,它具有很多内容,我想让这些内容以有组织的方式显示,并且我可以看到这是使用分页的最佳方式。我已经浏览了bootstrap文档,但是我无法解决这个问题,因为我之前从未使用过它。如何使用Netbeans使用引导3分页与PHP MVC?
型号:
public function showFilms($UserID){
//declare new film array
$film = array();
//SQL Query Selecting equivalent information to be displayed
$sqlQuery = 'SELECT FilmID, Title, Director,YearofRelease, Genre, Image, MainActor, MainActor1, MainActor2, Synopsis FROM films WHERE User ="' . $UserID . '" ORDER BY Title DESC';
// prepare a PDO statement
$statement = $this->_dbHandle->prepare($sqlQuery);
// Execute PDO statement
$statement->execute();
// While loop fetches each row matching query
while ($row = $statement->fetch()) {
$film[] = array('FilmID' => $row['FilmID'],
'Title' => $row['Title'],
'User' => $UserID,
'Director' => $row['Director'],
'YearofRelease' => $row['YearofRelease'],
'Genre' => $row['Genre'],
'Image' => $row['Image'],
'MainActor' => $row['MainActor'],
'MainActor1' => $row['MainActor1'],
'MainActor2' => $row['MainActor2'],
'Synopsis'=> $row['Synopsis']
);
}
//returning film array
return $film;
}
查看:
<div id="FilmArea">
<!-- Count for Films -->
<?php
if (count($film)) {
?>
<br>
<!-- Displaying each entry using count of hidden list value of id of entry -->
<?php foreach ($film as $list): ?>
<!-- Panel Start -->
<div class="panel panel-info">
<!-- Panel Header -->
<div class="panel-heading">
<h3 class="panel-title" style="font-family: sans-serif; font-size: 20px; color: black; ">
<?= ($list['Title']) ?> <small> Directed By : <?= ($list['Director']) ?></small>
</h3>
</div>
<!-- Panel Body -->
<div class="panel-body">
<div id='dvdHolder'>
<?= ($list['Image'] <> "" ? "<img style='max-width:200px; max-height:200px;' src='Images/{$list['Image']}'/>" : "") ?>
</div>
<div id='dvdInfo'>
<p style='font-weight: bold;'> Year Released : <?= ($list['YearofRelease']) ?></p>
<p style='font-weight: bold;'> Film Genre : <?= ($list['Genre']) ?></p>
<p style="font-weight: bold;"> Starring : <?= ($list['MainActor']) ?> , <?= ($list['MainActor1']) ?> , <?= ($list['MainActor2']) ?> </p>
<p style='font-weight: bold;'> Synopsis : <?= ($list['Synopsis']) ?></p>
</div>
</div>
</div>
<!-- End of Foreach Statement for Entry -->
<?php endforeach; ?>
<!-- Else show this message if user has no entries -->
<?php
}else {
?>
<p><b>No Films Added yet!</b></p>
<?php } ?>
</div>
控制器:
<?php
session_start();
require_once('Model/UserDataSet.php');
require_once('Model/FilmDataSet.php');
$view = new stdClass();
$view->pageTitle = 'My Vault';
$aa = new FilmDataSet();
$film = array();
$film = $aa->showFilms($_SESSION['Email']);
require_once('View/home.phtml');
我如何能实现分页任何帮助或信息进入我的应用程序将是伟大的。
您使用的是什么数据库引擎? –
您好我正在使用phpMyAdmin – MrWeiser