<?php
require('db.php');
include("auth.php");
$id=$_REQUEST['id'];
$query = "SELECT * from new_record where id='".$id."'"; 
$result = mysqli_query($con, $query) or die ( mysqli_error());
$row = mysqli_fetch_assoc($result);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>View Records</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<div class="form">
<p align='center'><a href="index.php">Home</a> | <a href="view.php">View Account</a> | <a href="logout.php">Logout</a></p>
<hr>
<p align='center'><font size='5'>Business Name Here</font></p>
<p align='center'><font size ='2'>Display Address here</font></p>
<p align='center'><font size ='2'>Contact Number here</font></p>
<hr>
    <table width="100%" border="1" style="border-collapse:collapse;">
    <thead>
    <tr><th><strong>Accnt No</strong>
    </th><th><strong>Name</strong>
    </th><th><strong>Address</strong></th>
    </th><th><strong>Contact No</strong></th>
    </th><th><strong>Loan Amount</strong></th>
    </th><th><strong>Loan Date</strong></th>
    </th><th><strong>Interest Rate</strong></th>
    </tr>
    </thead>
<tbody>
<?php
$count=0;
$sel_query="SELECT * from new_record where id='".$id."'";
$result = mysqli_query($con,$sel_query);
while($row = mysqli_fetch_assoc($result)) { ?>
<tr><td align="center"><?php echo $count; ?>
</td><td align="center"><?php echo $row["name"]; ?>
</td><td align="center"><?php echo $row["address"]; ?>
</td><td align="center"><?php echo $row["contact_no"]; ?>
</td><td align="center"><?php echo $row["loan_amount"]; ?>
</td><td align="center"><?php echo $row["loan_date"]; ?>
</td><td align="center"><?php echo $row["interest_rate"]; ?>
<?php $count++; } ?>
</tbody>
</body>
</html>

i can view name, address, contact No, Loan Amount, Loan Date and Interest Rate correctly the only problem is the ID

are you passing the id variable in the link to the page? When you do a $_REQUEST['id'] its looking for ?id=1 or ?id=testuser in the link from the previous page.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.