I connect to my database and get the table. I create an HTML table to list all of my corporations as well as an anchor tag for "Read" "Update" and "Delete" at the end of each row. If I click on "Read" next to one of the corporations, how can I get that specific corporation (or that specific row number) so I can pass it as a parameter. I want to display the information of that corporation on that row. Thanks!
`
try {
$sql = "SELECT corp FROM corps";
$sql = $db->prepare($sql);
$sql->execute();
$corps = $sql->fetchAll(PDO::FETCH_ASSOC);
if ($sql->rowCount() > 0) {
$table = "<table>" . PHP_EOL;
foreach ($corps as $corp) {
$table .= "<tr><td>" . $corp['corp'] . "</td><td>" . '<a href="../Lab3">Read</a>' . "</td><td>" . '<a href="../Lab3">Update</a>' . "</td><td>" . '<a href="../Lab3">Delete</a>' . "</td></tr>";
}
$table .= "</table>" . PHP_EOL . ' <a href="../Lab3">Create</a>';
} else {
$table = "No Corporations.". PHP_EOL;
}
} catch (PDOException $e){
die("There was a problem getting the Corporations");
}`