从数据库中选择所有管理员并放入数组[关闭]

I have a table in my database called dragonStaff with the following fields admins moderators tester I am trying to select the admins with this code and put them in the array $admin_array

    $result = mysql_query("SELECT * FROM dragonStaff") or   die(mysql_error());
    while($row = mysql_fetch_array(   $result )){
    $admins = $row['admins'];
     }
    $admin_array = implode(",",    $admins);

The point of this is so I can create content only certain people with permissions can access which i use this code(hint name is predefined in an include file)

    <? if(in_array($name,$admin_array)){?>
    //content
    <?}?>

I have added my name to the database for admin but the content is not displaying I have no clue what im doing wrong

Try the simple approach:

$result = mysql_query("SELECT * FROM dragonStaff") or   die(mysql_error());
$admin_array = array();
while($row = mysql_fetch_array(   $result )){
    $admin_array[] = $row['admins'];
}
print_r($admin_array);