Hejsa.
Fejl og fejl, pagination virker da.
Men problemet ligger i hvor den skal skifte den der skal være current ikke virker.
Kan nogen fortælle mig hvad jeg gør galt?
- <?php
- $per_page = 12;
-
- $pages_query = mysql_query("SELECT COUNT(id) FROM files WHERE type_id = '2' AND user_id = '1'") or die(mysql_error());
- $pages = ceil(mysql_result($pages_query, 0) / $per_page);
-
- $page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
- $start = ($page - 1) * $per_page;
-
- $pay = mysql_query("SELECT * FROM files WHERE type_id = '2' AND user_id = '1' LIMIT $start, $per_page") or die(mysql_error());
- while($row = mysql_fetch_assoc($pay))
- {
- echo "<tr>";
- echo "<td><input type='checkbox' /></td>";
- echo "<td>" . $row['name'] . "</td>";
- echo "<td>" . $row['description'] . "</td>";
- echo "<td>" . $row['month'] . "</td>";
- echo "<td>" . $row['year'] . "</td>";
- echo "<td>" . date('d.m.y', strtotime($row['created'])) . "</td>";
- echo "<td>" . date('d.m.y', strtotime($row['modified'])) . "</td>";
- echo "<td>" . $row['type_id'] . "</td>";
- echo "<td>" . $row['hits'] . "</td>";
- echo "<td><a href='index.php?action=download&file_url=" . $row['href'] . "&file_id=" . $row['id'] . "'>Download</a></td>";
- echo "<td class='actions'><a href=''><img src='images/edit.png' alt=''></a><a href='index.php?action=delete_file&file_id=" . $row['id'] . "'><img src='images/delete.png' alt=''></a></td>";
- echo "</tr>";
- }
- ?>
- </tbody>
- </table>
- <div class="left input">
- <select name="action" id="tableaction">
- <option value="">Rediger</option>
- <option value="">Slet</option>
- </select>
- </div>
- <div class="pagination">
- <?php
- if($pages >= 1 && $page <= $pages)
- {
- for($x=1; $x<=$pages; $x++)
- {
- echo ($x == $pages) ? "<a href='?page=\"" . $x . "\"' class='current'>" . $x . "</a>" : "<a href='?page=\"" . $x . "\"'>" . $x . "</a>";
- }
- }
- ?>
Se det i aktion her
Indlæg senest redigeret d. 15.03.2012 18:38 af Bruger #15663