PHP MYSQL loop to check if LicenseID Values are contained in mysql DB
First of all: both code and table design can (have?) to be improved:


Tables must be normalized and can be improved by removing data and duplicates

Users table can (?) have username only as natural PK (pure id eliminated)
Optional: licence table will be better understandable if FK will have same name as for Users table (username)  

For-cycle for your task is not-so-good style of coding:

You can just test result (size of array) of SELECT idLicense WHERE idLicense = $licenseID (SQLGuru: Fixme!!!)
Total amount of licences per user can be extracted from table with single SELECT COUNT(idLicense) WHERE idUser = '$username' (SQLGuru: Fixme again!!!)