Hello, how would i display everything in a table in a database but then add a html button to the side of every record. If you click the button next to the record (username = Daniel) then it would goto ww.site.com/change.php?var=Daniel but what would be the code for all of that?
Thanks, Daniel
Control Panel
Moderator: General Moderators
this should work:
good luck!
Code: Select all
<?php
$query = "SELECT * FROM users;";
$result = mysql_query($query) or die ('ERR nr1');
?>
<table border="1">
<?php
while ($row = mysql_fetch_assoc($result))
{
?>
<tr>
<td>
<?php echo $row['user_id']; ?>
</td>
<td>
<?php echo $row['col_name2']; ?>
</td>
<td>
<?php echo $row['col_name3']; ?>
</td>
<td>
<a href="www.site.com/change.php?var=<?php echo $row['user_id']; ?>">EDIT LINK</a>
</td>
</tr>
<?php
}
?>
</table>good luck!