【发布时间】:2014-11-14 00:47:13
【问题描述】:
我有这个分页脚本
1 个展示页面
$result_p = mysqli_query($conexao, "select count(*) as count FROM `banner-destaque`");
$row_p = mysqli_fetch_array($result_p);
$quant_resul = 10;
$pagina = 1;
$paginas = ceil($row_p['count'] / $quant_resul);
$result = mysqli_query($conexao, "select * FROM `banner-destaque` limit 0 , " . $quant_resul);
该脚本适用于一个 mysql 表,但我需要为其他不同大小的 mysql 表重用相同的分页脚本。
这是显示结果的表格
<table class="flat-table flat-table-1">
<thead>
<th>Id</th> **//Here i need get tables columns name to make it dinamically for reuse in other tables**
<th>Photo</th>
<th>Title</th>
<th>Description</th>
</thead>
<tbody>
<tr>
<?php
while ($row = mysqli_fetch_object($result)) {
echo
'
//and here i need get all columns values to populate the above column.
<td>'.$row->id.'</td>
<td>'.$row->foto.'</td>
<td>'.$row->titulo.'</td>
<td>'.$row->descricao.'</td>';
};
?>
有什么解决办法吗?谢谢。我正在使用mysqli连接数据库。
【问题讨论】:
标签: php mysql pagination