php - Omit array from sql query -



php - Omit array from sql query -

i displaying list of "absent players" site, , have omitted "admin" username displaying in list. have added array of "inactive players", not sure how omit array sql query well.

here code:

//display list of absent players $sql = "select * " . $db_prefix . "users userid not in(" . implode(',', array_keys($playertotals)) . ") , username <> 'admin'"; $query = mysql_query($sql); if (mysql_num_rows($query) > 0) { $absenthtml = '<p style="color: #7a7a7a; position: relative"><b>absent players:</b> '; $i = 0; while ($result = mysql_fetch_array($query)) { if ($i > 0) $absenthtml .= ', '; switch ($user_names_display) { case 1: $absenthtml .= trim($result['firstname'] . ' ' . $result['lastname']); break; case 2: $absenthtml .= $result['username']; break; default: //3 $absenthtml .= '<abbrev title="' . trim($result['firstname'] . ' ' . $result['lastname']) . '">' . $result['username'] . '</abbrev>'; break; } $i++; } echo $absenthtml;

the array, located elsewhere, looks this:

//list of inactive users $inactiveusers = array('user1','user2','user3');

as can see, and username <> 'admin' omits "admin" name, have no clue how add together array $inactiveusers well.

any help appreciated.

$sql = "select * ".$db_prefix."users userid not in (".implode(',', array_keys($playertotals)).") , username not in ('admin', '".implode("','", $inactiveusers)."')";

php sql

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -