I have a table which contains:
transaction_id | the_pet | name_of_the_owners
1 dog shiela
2 dog ben
3 dog alice
4 cat jonathan
and on my query:
$query="select * from table ORDER BY name_of_the_owner limit 5";
$r=mysqli_query($query);
while ($row=mysqli_fetch_array($r)) {
echo "<tr>";
echo "<td><a href='../php/ownersname.php?the_pet=".$row['the_pet']."'>".$row['the_pet']."</a></td>";
echo "</tr>";
}
However, when I use the $query, it shows all the data from the table. What I need is this:
the_pet
dog (hyperlink)
cat (hyperlink)
So whenever I click on the hyperlink, the name_of_the owners will be shown in another page
for the dog when clicked
name_of_the_owners
shiela
ben
alice
I already used
$query = "SELECT MAX(transaction_id) as transaction_id, the_pet GROUP BY the_pet, name_of_the_owners;
but when I clicked on the hyperlink, it doesn't show the owners. :(