add functions.php
get number of products from db
add dbconnection
added some loops
refactor