Page 1 of 1

Control Panel

Posted: Sun Sep 17, 2006 5:05 am
by Drezard2
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

Posted: Sun Sep 17, 2006 6:59 am
by Omsis
this should work:

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! ;)