lee2010 Posted March 5, 2011 Share Posted March 5, 2011 hi all, i have a page which lists all of my registered users from the mysql database but i want the ability to edit an account, here is my list users code (just shown the appropiate code and not the rest): <?php require ('../secure/connect.php'); $sql = "SELECT * FROM users ORDER BY user_level ASC"; $result=mysql_query($sql); echo '<table width="80%" border="0" cellspacing="5" cellpadding="0">'; echo ' <tr> <th><p align="left">User ID:</th> <th><p align="left">User Level:</th> <th><p align="left">Username:</th> <th><p align="left">User Title:</th> <th><p align="left">Email:</th> <th><p align="left">Actions:</th> </tr>'; while($rows=mysql_fetch_array($result)){ ?> <tr> <td><?php echo $rows['userid']; ?></td> <td><?php echo $rows['user_level']; ?></td> <td><?php echo $rows['username']; ?></td> <td><?php echo $rows['user_title']; ?></td> <td><?php echo $rows['email']; ?></td> <td><a href="edit_account.php?id=">Edit Account</a></td> </tr> <?php } ?> this lists my users nicely, as you can see i put it a edit account action at the end with a empty id= because that may be a way of doing it but im not sure what else to do or if there is a better way of doing it. any help would be great! Link to comment https://forums.phpfreaks.com/topic/229721-edit-accounts/ Share on other sites More sharing options...
Eiolon Posted March 5, 2011 Share Posted March 5, 2011 Just echo the ID in your link. <td><a href="edit_account.php?id=<?php echo $rows['userid'] ?>">Edit Account</a></td> On your edit page, use $_GET to get the ID you just echo'd and query the specific user with that ID. Link to comment https://forums.phpfreaks.com/topic/229721-edit-accounts/#findComment-1183390 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.