Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Table extends Grid {
- public function render(){
- echo "
- <table>
- <tr>
- <th>Id</th>
- <th>Title</th>
- <th>Link</th>
- </tr>
- ";
- $this->getData();
- }
- public function getData(){
- $db_host = "localhost";
- $db_name = "dbpaging";
- $db_user = "root";
- $db_pass = "";
- $db = new PDO("mysql:host=$db_host;dbname=$db_name", $db_user, $db_pass);
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $users = $db->query("SELECT * FROM tbl_tutorials");
- foreach ($users as $user) {
- $tuts_id = $user['tuts_id'];
- $tuts_title = $user['tuts_title'];
- $tuts_link = $user['tuts_link'];
- echo"
- <tr>
- <td>$tuts_id</td>
- <td>$tuts_title</td>
- <td>$tuts_link</td>
- </tr>
- ";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement