Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $link = mysqli_connect("localhost","root","","firstdbase");
- if($link===false){
- die("error:could not connect. " . mysqli_connect_error());
- }
- $sql = "SELECT * FROM tbl_username";
- if($result = mysqli_query($link, $sql)){
- if(mysqli_num_rows($result) > 0){
- echo "<table class='table table-bordered table-responsive'>";
- echo "<tr>";
- echo "<th>ID</th>";
- echo "<th>Username</th>";
- echo "</tr>";
- while ($row = mysqli_fetch_array($result)) {
- echo "<tr>";
- echo "<td>" .$row['ID']. "</td>";
- echo "<td>" .$row['username']. "</td>";
- echo "</tr>";
- }
- echo "</table>";
- mysqli_free_result($result);
- }
- else
- {
- echo "No records found";
- }
- }
- else{
- echo "Error: could not able to execute " .mysqli_error($link);
- }
- mysqli_close($link)
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement