Creating a gallery of products

Good day,

We are finishing a website for selling books.
We are working now in a gallery of products for customers are able to purchase online.
We have created a testing gallery here:

The problem is we have made it using different HTML divisions for wrapping three objects.

What we’d like to do is to have a PHP script for loading information from a database with product features and show each of them in the screen, properly wrapped with the CSS styles we have, showing them exactly as they are today.

We already have a MySQL database with name, picture, description, stock, etc. this is not the problem.

The question is:
Having CSS styles defined for each product in the gallery (for seeing them as showed in the link), could you please give some tips about how to create a PHP script for reading the data from MySQL and properly display them in the screen? I need three items per line, and after a line is ready, a new one is created for fitting three new elements until MySQL table is finish.

Thanks a lot!!

I get a 404 ‘not found’ error on that link.