connect($servername,$username,$password,$dbname); $query = "SELECT * FROM adsuser WHERE access='MITARBEITER' "; $result = mysqli_query($connection,$query) or die("Query failed"); $i = 0; // while ($row = mysqli_fetch_array($result)) { if ($i < 3) { // if(!($addUser->checkIfExists(utf8_encode($row['username'])))) { $addUser->createUser($row); } $i++; // } else { // break; // } // } }