-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTable.php
44 lines (38 loc) · 1.11 KB
/
Table.php
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<?php
$con=mysqli_connect("localhost","id3287709_bus","12345","id3287709_bus");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="SELECT name,adminno,branch,dfrom FROM bus2";
if ($result=mysqli_query($con,$sql))
{
echo"<table class='table' > <thead><tr>
<th>ID</th>
<th>Name</th>
<th>Admino</th>
<th>branch</th>
<th>From</th>
</tr> </thead> <tbody> ";
// Fetch one and one row
$id=1;
while ($row=mysqli_fetch_row($result))
{
echo" <tr> " ;
echo" <td>$id</td>";
echo" <td>$row[0]</td>";
echo"<td>$row[1]</td> ";
echo"<td>$row[2]</td>";
echo"<td>$row[3]</td>";
echo"</tr>";
$id++;
echo"</n>";
}
echo "</tbody> </table> " ;
// Free result set
mysqli_free_result($result);
}
mysqli_close($con);
?>