首先我假设你已经连接到你的数据库
在浏览器中存储数据以在调用时显示
<?php
// Write out our query.
//colum table
$query = "SELECT username FROM rc_accounts WHERE isdm = '0'";
// Execute it, or return the error message if there's a problem.
$result = mysql_query($query) or die(mysql_error());
?>
在下拉菜单中显示存储的数据
<?php
$dropdown = "<select name='users'>";
while($row = mysql_fetch_assoc($result)) {
$dropdown .= "\r\n<option value='{$row['username']}'>{$row['username']}</option>";
}
$dropdown .= "\r\n</select>";
echo $dropdown; ?>
如果你从浏览器写什么,那么你需要这个,这不在我的网站上,它使用复选框来确认
<?php
if(isset($_POST['sure'])) {
mysql_query("UPDATE rc_accounts SET isdm = '1' WHERE username = '".$_POST['users']."'");
echo '<font color="#FFFF00"><b>GM Add Successfull.</font>';
} else {
echo '<font color="#FFFF00"><b>If you want to make this account a GM, then click the box!</font>';
}
?>