-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphpfile
33 lines (33 loc) · 771 Bytes
/
phpfile
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
<?php
$con=mysqli_connect("localhost","username","password","name_of_database");//alter this
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if(!isset($_SESSION)){
}
$srno = $_REQUEST['srno'];
$_SESSION['srno'] = $srno;
if($result = mysqli_query($con,"SELECT * FROM users WHERE srno = '$_SESSION[srno]'"));//name of table after from
{
echo(mysqli_error($con));
}
echo "<table border='1'>
<tr>
<th>srno</th>
<th>name</th>
<th>city</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['srno'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['city'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_free_result($result);
mysqli_close($con);
?>