John Davidson

php - While Loop taking ID value for a href

0 comments
Message:


while loop:


   <tbody>
<?php while($row=$result->fetch_assoc()){ ?>
<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>
<?php } ?>
</tbody>

when I press the a href for each record it always results in this url
http://localhost/helloworld/read.php?id=%27.%20$row[%27id%27]%20.%27


I think its the syntax of the ---- > href="read.php?id='. $row['id'] .'" but I've tried all the variations that I can find as a php beginner, it's driving me nuts!



My Answer:
$id = 1;

while ($id <= 10) {
echo 'Link ' . $id . '
';
$id++;
}
?>

Rate this post

5 of 5 based on 7898 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us