Hi there

I don't quite know how to do this.
I am coding a kind of poll system.
Around 1000 products to be voted on. Each with a small picture.

It has to be based on a userdatabase to ensure that no one can vote on the same product more than once. I guess that is better than relying on cookies.

The pictures, I guess, has to be placed in the database (how to do this?), or is it better in a folder?

What is the best method here, one or more tables to make it run as fast and stable as possible.
There might be many, many thousands of users.
I am using MySql.

sincerely
qrt123

    Firstly, always store the images in folders, and the paths/filenames in the database/. Although you CAN store them as BLOBS in the database, it isn't really advisable.

    For the actual polling system, I would keep it as simple as possible, where you have one (or more) tables which create the actual page, and one reponse table for the voting. The resaponse table simply consists of 2 fields, userid (linked to a unique userid contained in the same table as your user information) and prodid (linked to the table containg the list of items that are being voted on).

    When a user votes, a select query is run on the response table against their username, if the number of rows returned is not 0, they have voted before and cannot vote again. This table, although potentially having many thousands of records, will contain all of the information you need about the voting to produce any kind statistics you may require.

    Hope this helps

      Write a Reply...