Wag! interview question

Technical PHP/JS/SQL challenges, not very difficult to resolve it.