Reputation: 11
<?php
$sql = "SELECT * FROM enquiry_form LEFT
JOIN mstpackage ON enquiry_form.no_of_days=mstpackage.no_of_days
ORDER BY enquiry_form.id DESC LIMIT 1";
$result = $conn->query($sql);
?>
<?php
for($i=1;$i<=$result;$i++)
{
$row=mysqli_fetch_array($result);
After fetching data show something like that
If I am clicking any generated link through the id for single record then only data show last inserted record something like that
You can see first image id is 20 and name is AK but data showing 21 id you can see above the
Actually, data fetch last record correctly in this type but I am clicking old enquiry data then URL is proper and id is proper but inside the content data change last inserted record
Upvotes: 0
Views: 22
Reputation: 2193
This
ORDER BY enquiry_form.id DESC LIMIT 1
means your query will always return the record with the greatest id. If you want a different record you will need to pass that in to your query somehow. I suggest using PDO and a bound parameter.
Upvotes: 1