i am faily new to php, and don't really know what i am doing, but understand the logic.
I have this script witch lists users in userclass 1 and 8, so when a user is in userclass 8, he is also in userclass 1. And userclass 1 is just 1.
What i need is to strip the duplicate username when the user is in class 8.
Any help is much appreciated! Been trying for several hours on my own now lol!
<?php
require_once("../../class2.php");
function list_users($uclass = 1){
$u_sql = new db();
$result = array();
$query = "SELECT user_id, user_class, user_name FROM #user WHERE find_in_set('{$uclass}', user_class) ORDER BY user_id";
if ($u_sql->db_Select_gen($query, true)){
while ($row = $u_sql->db_Fetch(MYSQL_ASSOC)){
$result[] = $row['user_name'];
}
}
if (count($result))
{
return implode("\n", $result);
}
else
{
return ("Ingen i klasse ". $uclass);
}
}
$text = list_users(1)."\n".list_users(8);
$file = "reserved_slots.txt";
$handle = fopen($file, 'w') or die("can't open file");
$data = $text;
fwrite($handle, $data);
fclose($handle);
$ns->tablerender($text);`enter code here`