User management interface How to do, output all the user name, operation only need to delete on it
Like this.
User name action
Zhang San Delete
John Doe Delete
Harry Delete
Thank you!
------to solve the idea----------------------
List is all select out, loop output just.
If you delete it, you can pass an ID and then delete that record with SQL based on the ID.
------to solve the idea----------------------
List page
/* User table structure
Id
Name
*/
Database connection
$SQLSTR = "SELECT * from user";
$query = mysql_query ($sqlstr) or Die (Mysql_error ());
Echo '
'; Echo '
| User name |
Operation |
' while ($thread = Mysql_fetch_assoc ($query)) { echo '
| '. $thread [' name ']. ' |
Delete |
';} Echo '
';
?>
Delete Page
Database connection
$id = Isset ($_get[' id ')? $_get[' id ']: 0;
$sqlstr = "Delete from user where id= '". Intval ($id). "'";
mysql_query ($sqlstr) or Die (Mysql_error ());
Echo ' Delete succeeded ';
?>