Last active
August 29, 2015 14:09
-
-
Save hechien/203c8cac7f340372e838 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $sql = "SELECT * FROM `call`"; | |
| $result = mysql_query($sql); | |
| ?> | |
| <table> | |
| <tbody> | |
| <?php | |
| while(($record = mysql_fetch_assoc($result))){ | |
| ?> | |
| <tr> | |
| <td><?php echo $record["id"]; ?></td> | |
| </tr> | |
| <?php | |
| } | |
| ?> | |
| </tbody> | |
| </table> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $limit = 5; | |
| $offset = intval($_GET["page"]) * $limit + 1; | |
| $sql = "SELECT * FROM shop LIMIT $limit OFFSET $offset"; | |
| $total_pages = (mysql_num_result($result) / $limit) + 1; | |
| for($i = 1; $i <= $total_pages; $i++){ | |
| <a href="call.php?page=$i">第 $i 頁</a> | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment