Retrieve All the Data in Database Table in Table Format

-- 1 comment
Hello there Here we Will display all the data stored in database table in html.
For this example we use the Example code of

Php Program To Connect With Database, Create Table To Connect with database, create table and insert data to the database. And From this code below we can display the stored data.

Q.Write PHP code that retrieves all the districts from database in tabular format. Pokhara University [2012 -Spring] Course: Web Technology

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!doctype html>
<html>
<head>
 <title>All the datas from Table in Database</title>
</head>
<body>
 <?php
 include "connect.php";
 $sql = "SELECT id,name,email FROM info";
 $result = $conn->query($sql);
 echo "<table border='1'>";
  echo "<tr>";
   echo "<th> Id </th>";
   echo "<th> Name </th>";
   echo "<th> Email </th>";
  echo "</tr>";
 while($row = $result->fetch_assoc()) { 
  echo "<tr>";
   echo "<td>" . $row["id"]. "</td>";
   echo "<td>" . $row["name"]. "</td>";
   echo "<td>" . $row["email"]. "</td>";
  echo "</tr>";
 }
 echo "<table>";
 ?>
</body>
</html>

Here is our info Table in Database:
Here is the Output of the Code Above

Id Name Email
1 Sagar Devkota info@devkotasagar.com.np
2 Ram Hari ram@hari.com.np
3 Mr Bean mr@bean.com.np
4 Cristiano Ronaldo Cristiano@Ronaldo.com.np
5 Tom Cruise tom@cruise.com.np
6 Raffey Cassidy Raffey@Cassidy.com.np

This is all. You can find the code in Github https://github.com/InfoDevkota/phpformmysql/tree/master (Master Branch) Issuers and pull requested are accepted.
If something is wrong or Need more clarification  Please contact me: info[at]devkotasagar.com.np.

Hello This is Sagar Devkota. Studying Bachelor of Software Engineering at Pokhara University. I know something about Linux, Android, Java, Nodejs, Unity3D and 3 dots :)

1 comment: Leave Your Comments

  1. The Oklahoma City police arrested eight individuals for illegally playing.OKC police stated the bust occurred Friday night after tips came from basic public} in regards to the unlawful scheme. Gary Knight, OKC police.Friday night, OKC police searched the realm after 카지노사이트 tips of the operation had been reported to their detectives. "The clients, for one, presumably be}. And there could be no regulation. So, type of|what kind of} playing is it, and is it truthful, is it skewed in some fashion?" Harwell stated.How are you aware if this is taking place the place you live? Regardless of the machine—slots, video poker—casinos’ ultimate aim is to maximize players’ “time on gadget.” This is essential for casinos, as a result of|as a end result of} given enough time, the home all the time wins.

    ReplyDelete