Create PHP sql query repeated lists

PLEASE REVIEW