Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style>
- /*
- table a:link {
- color: #666;
- font-weight: bold;
- text-decoration:none;
- }
- table a:visited {
- color: #999999;
- font-weight:bold;
- text-decoration:none;
- }
- table a:active,
- table a:hover {
- color: #bd5a35;
- text-decoration:underline;
- }
- */
- table {
- font-family:Arial, Helvetica, sans-serif;
- color:#666;
- font-size:12px;
- text-shadow: 1px 1px 0px #fff;
- background:#eaebec;
- margin:20px;
- border:#ccc 1px solid;
- width: 100%;
- -moz-border-radius:3px;
- -webkit-border-radius:3px;
- border-radius:3px;
- -moz-box-shadow: 0 1px 2px #d1d1d1;
- -webkit-box-shadow: 0 1px 2px #d1d1d1;
- box-shadow: 0 1px 2px #d1d1d1;
- }
- table th {
- padding:21px 25px 22px 25px;
- border-top:1px solid #fafafa;
- border-bottom:1px solid #e0e0e0;
- background: #ededed;
- background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#ebebeb));
- background: -moz-linear-gradient(top, #ededed, #ebebeb);
- }
- table th:first-child {
- text-align: left;
- padding-left:20px;
- }
- table tr:first-child th:first-child {
- -moz-border-radius-topleft:3px;
- -webkit-border-top-left-radius:3px;
- border-top-left-radius:3px;
- }
- table tr:first-child th:last-child {
- -moz-border-radius-topright:3px;
- -webkit-border-top-right-radius:3px;
- border-top-right-radius:3px;
- }
- table tr {
- text-align: center;
- padding-left:20px;
- }
- table td:first-child {
- text-align: left;
- padding-left:20px;
- border-left: 0;
- }
- table td {
- padding:18px;
- border-top: 1px solid #ffffff;
- border-bottom:1px solid #e0e0e0;
- border-left: 1px solid #e0e0e0;
- background: #fafafa;
- background: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#fafafa));
- background: -moz-linear-gradient(top, #fbfbfb, #fafafa);
- }
- table tr.even td {
- background: #f6f6f6;
- background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#f6f6f6));
- background: -moz-linear-gradient(top, #f8f8f8, #f6f6f6);
- }
- table tr:last-child td {
- border-bottom:0;
- }
- table tr:last-child td:first-child {
- -moz-border-radius-bottomleft:3px;
- -webkit-border-bottom-left-radius:3px;
- border-bottom-left-radius:3px;
- }
- table tr:last-child td:last-child {
- -moz-border-radius-bottomright:3px;
- -webkit-border-bottom-right-radius:3px;
- border-bottom-right-radius:3px;
- }
- table tr:hover td {
- background: #f2f2f2;
- background: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#f0f0f0));
- background: -moz-linear-gradient(top, #f2f2f2, #f0f0f0);
- }
- .btn {
- background: #3498db;
- background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
- background-image: -moz-linear-gradient(top, #3498db, #2980b9);
- background-image: -ms-linear-gradient(top, #3498db, #2980b9);
- background-image: -o-linear-gradient(top, #3498db, #2980b9);
- background-image: linear-gradient(to bottom, #3498db, #2980b9);
- -webkit-border-radius: 28;
- -moz-border-radius: 28;
- border-radius: 28px;
- font-family: Arial;
- color: #ffffff;
- font-size: 20px;
- padding: 10px 20px 10px 20px;
- text-decoration: none;
- }
- .btn:hover {
- background: #3cb0fd;
- background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);
- background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);
- background-image: -ms-linear-gradient(top, #3cb0fd, #3498db);
- background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
- background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
- text-decoration: none;
- }
- </style>
- <?php
- /**
- * Mysqli initial code
- *
- * User permissions of database
- * Create, Alter and Index table, Create view, and Select, Insert, Update, Delete table data
- *
- * @package PhpFiddle
- * @link http://phpfiddle.org
- * @since 2012
- */
- require_once "dBug!.php";
- require "util/public_db_info.php";
- $short_connect = new mysqli($host_name, $user_name, $pass_word, $database_name, $port);
- //get all tables in the database
- //$sql = "SHOW TABLES";
- //get column information from a table in the database
- //$sql="SELECT COLUMN_KEY, COLUMN_NAME, COLUMN_TYPE FROM information_schema.COLUMNS WHERE TABLE_NAME = 'books'";
- //SQL statement for a table in the database
- $sql = "SELECT * FROM komentar";
- ?>
- <a href="add.php" class="btn">Add Komenter</a>
- <table cellspacing='0'> <!-- cellspacing='0' is important, must stay -->
- <!-- Table Header -->
- <thead>
- <tr>
- <th>#</th>
- <th>Nama</th>
- <th>Komentar</th>
- <th>Action</th>
- </tr>
- </thead>
- <!-- Table Header -->
- <!-- Table Body -->
- <tbody>
- <?php
- //result is boolean for query other than SELECT, SHOW, DESCRIBE and EXPLAIN
- $result = $short_connect->query($sql);
- if (($result) && ($result->num_rows > 0))
- {
- $results = array();
- //convert query result into an associative array
- while ($row = $result->fetch_assoc())
- {
- ?>
- $results[] = $row;
- <tr>
- <td><input type="checkbox" name="id[]" value="<?php echo $row['id'];?>"></td>
- <td><?php echo $row['nama'];?></td>
- <td><?php echo $row['komentar'];?></td>
- <td><a href="edit.php?id=<?php echo $row['id'];?>" class="btn">Edit</a><a href="delete.php?id=<?php echo $row['id'];?>" class="btn">Delete</a></td>
- </tr><!-- Table Row -->
- <?php
- }
- ?>
- <?php
- //dump all data from associative array converted from query result
- new dBug($results);
- $result->free();
- }else{
- ?>
- <tr>
- <td colspan="4">Data Kosong</td>
- </tr><!-- Table Row -->
- <?php
- }
- $short_connect->close();
- ?>
- </tbody>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment