Yes, it is possible to select data by id. You can select the MYSQL database table row using the id. It's called specific data by the user. It selects the specific row by SQL query.
The SQL query -
SELECT name FROM `table_name` WHERE id=1;
SELECT name FROM `table_name` WHERE id=2;
SELECT name FROM `table_name` WHERE id=3;
You can select the name from the
SELECT * FROM `table_name` WHERE id=1;
SELECT * FROM `table_name` WHERE id=2;
SELECT * FROM `table_name` WHERE id=3;
MYSQL table using a query. If you want to select complete row data by id, then use the SQL query.
The SQL query to select the entire row by id -
The above SQL query helps to select the entire row data by id.
If you want to display the entire data by id, then use the PHP GET method. The GET method holds the id by https URL.
Select the data and display it in HTML like this -
<?php
include_once("config.php");
$result = mysqli_query($mysqli, "SELECT * FROM table_name ORDER BY id DESC");
?>
<table>
<?php
while($res = mysqli_fetch_array($result)) {
echo '<tr>';
echo "<td>".$res['name']."</td>";
echo"</td><td><a href="display.php?id=$res[id]">Display</a>";
echo '</tr>';
}
?>
</table>
It selects the data and displays it into the HTML table.
Now, you need to create another PHP to display the whole data by id.
Create a display.php page.
<?php
include_once("config.php");
$id = $_GET['id'];
$result = mysqli_query($mysqli, "SELECT * FROM tabel_name WHERE id=$id");
while($res = mysqli_fetch_array($result))
{
$name = $res['name'];
//you can display more row data by id
}
?>
<?php echo $name; ?>
It will display specific data by id.
I have another reference for you. You need to learn it.
CRUD application in PHP