php while loop – html a href inside loop of data

Issue

This Content is from Stack Overflow. Question asked by Amphrite

I’m trying to get my while loop to function when fetching data that is equal to input field.
The Data set is functional, but I want to add a read, update and delete function to each field of data through an with allocated ID.

                  <tbody>";
                    while($row=$result->fetch_assoc()){
                        $output .="
                        <tr>
                            <td>".$row['id']."</td>
                            <td>".$row['fornavn']."</td>
                            <td>".$row['efternavn']."</td>
                            <td>".$row['mail']."</td>
                            <td>".$row['kursistnummer']."</td>
                            <td>".$row['unilogin']."</td>
                            
                            <td><a href="read.php?id='. $row['id'] .'" class="mr-3" title="View Record" data-toggle="tooltip"><span class="fa fa-eye"></span></a></td>
                        </tr>";
                    }
                    $output .="</tbody>";
                    echo $output;

It outputs the following error

“Parse error: syntax error, unexpected identifier “read” in
C:xampphtdocshelloworldaction.php on line 38″

so im guessing its a syntax error in my href



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?