query("SELECT * FROM $type ORDER BY listId"); if ($result === FALSE) { $result = $conn->query("SELECT * FROM $type ORDER BY UID"); } while($row = $result->fetchArray()) { if (isset($row['name'])) { $name = $row['name']; } else { $name = $row['User']; } ?>