nice way of prasentation and
nice way of prasentation and it is easy to understand
-- -- Table structure for table `user_registration` -- CREATE TABLE `user_registration` ( `user_id` INT(11) NOT NULL, `first_name` VARCHAR(100) NOT NULL, `last_name` VARCHAR(100) NOT NULL, `user_name` VARCHAR(100) NOT NULL, `password` VARCHAR(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- -- Dumping data for table `user_registration` -- INSERT INTO `user_registration` (`user_id`, `first_name`, `last_name`, `user_name`, `password`) VALUES (1, 'Jane', 'Doe', 'jane24', 'doe23jd'), (2, 'John', 'Doe', 'john43', 'john_doe325kh'), (3, 'Sarah', 'Geronimow', 'sarahGero', 'geronimow243'), (4, 'Super', 'Man', 'returns', 'superman_returns');
<?php $db_server = "localhost"; $db_username = "root"; $db_password = ""; $db_database = "registration_pdo"; $conn = new PDO("mysql:host=$db_server;dbname=$db_database", $db_username, $db_password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); ?>
<table border="1" cellspacing="5" cellpadding="5" width="100%"> <thead> <tr> <th>No.</th> <th>First Name</th> <th>Last Name</th> <th>User Name</th> <th>Password</th> </tr> </thead> <tbody> <?php require_once('connection.php'); $result = $conn->prepare("SELECT * FROM user_registration ORDER BY user_id ASC"); $result->execute(); for($i=0; $row = $result->fetch(); $i++){ ?> <tr> <td><label><?php echo $row['user_id']; ?></label></td> <td><label><?php echo $row['first_name']; ?></label></td> <td><label><?php echo $row['last_name']; ?></label></td> <td><label><?php echo $row['user_name']; ?></label></td> <td><label><?php echo $row['password']; ?></label></td> </tr> <?php } ?> </tbody> </table>
<style type="text/css"> body { width:800px; border:red 1px solid; border-style:dashed; margin:auto; padding:10px; } td { text-align:center; padding:10px; } table { margin:auto; border:blue 1px solid; } label { font-size:18px; color:blue; font-weight: bold; font-family: cursive; } h2 { color:red; text-align:center; } th { color:red; font-size:20px; font-family: cursive; } </style>