Sample PHp VIEW By ID Post Result
Fron Otehr List
<a href="l.php?id=<?php echo $row['id']; ?>"> <img src="files/<?php echo $row['eidFront']; ?>" width="60" style="border:1px solid #333333;"></a>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/-bootstrap.min.css">
<script src="js/-jquery.min.js"></script>
<script src="js-/bootstrap.min.js"></script>
<style>
* {
box-sizing: border-box;
}
.row::after {
content: "";
clear: both;
display: table;
}
#customers {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#customers td, #customers th {
border: 1px solid #ddd;
padding: 8px;
}
#customers tr:nth-child(even){background-color: #f2f2f2;}
#customers tr:hover {background-color: #ddd;}
#customers th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #4CAF50;
color: white;
}
</style>
<?php
$conn = new mysqli("localhost", "root", "password", "contact");
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
<?php
$id=$_GET['id'];
$msql = mysqli_query($conn, "SELECT * FROM contact WHERE id='$id'");
while($c=mysqli_fetch_array($msql))
{
$id=$c['id'];
$Name=$c['Name'];
$Phone=$c['Phone'];
$MemberNo=$c['MemberNo'];
$Country=$c['Country'];
$newViews = $c['views']+1;
$query2 = mysqli_query($conn,"update contact set views = ".$newViews." where id=".$id);
?>
<table id="customers">
<thead>
<tr>
<th width="37">No</th>
<th width="140">Name</th>
<th width="125">MobileNo</th>
<th width="99">Member</th>
<th width="101">Nationality</th>
<th width="178">Views</th>
</tr>
</thead>
<tbody>
<tr>
<?php
$no = 1; ?>
<td><?php echo $no; $no++ ?></td>
<td><?php echo $Name; ?></td>
<td><?php echo $Phone; ?></td>
<td><?php echo $MemberNo; ?></td>
<td><?php echo $Country; ?></td>
<td><?php echo $newViews; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
Fron Otehr List
<a href="l.php?id=<?php echo $row['id']; ?>"> <img src="files/<?php echo $row['eidFront']; ?>" width="60" style="border:1px solid #333333;"></a>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/-bootstrap.min.css">
<script src="js/-jquery.min.js"></script>
<script src="js-/bootstrap.min.js"></script>
<style>
* {
box-sizing: border-box;
}
.row::after {
content: "";
clear: both;
display: table;
}
#customers {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#customers td, #customers th {
border: 1px solid #ddd;
padding: 8px;
}
#customers tr:nth-child(even){background-color: #f2f2f2;}
#customers tr:hover {background-color: #ddd;}
#customers th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #4CAF50;
color: white;
}
</style>
<?php
$conn = new mysqli("localhost", "root", "password", "contact");
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
<?php
$id=$_GET['id'];
$msql = mysqli_query($conn, "SELECT * FROM contact WHERE id='$id'");
while($c=mysqli_fetch_array($msql))
{
$id=$c['id'];
$Name=$c['Name'];
$Phone=$c['Phone'];
$MemberNo=$c['MemberNo'];
$Country=$c['Country'];
$newViews = $c['views']+1;
$query2 = mysqli_query($conn,"update contact set views = ".$newViews." where id=".$id);
?>
<table id="customers">
<thead>
<tr>
<th width="37">No</th>
<th width="140">Name</th>
<th width="125">MobileNo</th>
<th width="99">Member</th>
<th width="101">Nationality</th>
<th width="178">Views</th>
</tr>
</thead>
<tbody>
<tr>
<?php
$no = 1; ?>
<td><?php echo $no; $no++ ?></td>
<td><?php echo $Name; ?></td>
<td><?php echo $Phone; ?></td>
<td><?php echo $MemberNo; ?></td>
<td><?php echo $Country; ?></td>
<td><?php echo $newViews; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
0 comments:
Post a Comment