Solution 1 :

You need some ID from database example: $data[“id”]

    while ($data = mysqli_fetch_assoc($output)) {
    echo "<tr>";
    echo "<td>". $data["cashflow"] ."</td>";
    echo "<td>". $data["amount"] ."</td>";
    echo "<td>". $data["description"]."</td>";
    echo '<td><a href="URL TO EDIT?id='.$data["id"].'">Edit</a></td>';

Problem :

I have written php code that outputs a php table and for each row, I want to be able to add an extra column to an edit and delete link (CRUD functionality). Currently I have been able to add the extra column but I am unsure on how to actually add the edit and update links in each row. My table currently looks like this.

The table is made using html code and the data is received using php code that is linked to another file. The following is the html code,

      <table class="content-table">
          <th colspan="2">Action</th>
        <?php include_once('data.php'); ?>


The following is the php code (data.php):

      while ($data = mysqli_fetch_assoc($output)) {
    echo "<tr><td>". $data["cashflow"] ."</td><td>". $data["amount"] ."</td><td>". $data["description"] ;


Comment posted by user3783243

Have you tried putting

Comment posted by El_Vanja

Edit and update links? Isn’t that the same thing?

Comment posted by jim erouip

@user3783243 how would I incorporate that in the php echo code?

Comment posted by jim erouip

@El_Vanja sorry I meant edit and delete. I have made the necessary corrections in the question.

Comment posted by

Same way you’ve done the

Comment posted by

Don’t need 5 echos.

Comment posted by WiatroBosy

I specially wrote that it was clean and clear. Because its code is not readable