views:

88

answers:

2

I have a mysql database with a table of ebay users, and their individual auctions. What I wish to do is to be able to "monitor" certain users, which would basically include retriving all of the auctions of any monitored users. I would like to know the best way to do this.

I am thinking of having another table, with just one column containing the names of monitored users, and doing a join between the auction table and the users table.

Or would it be better to simply feed watched users names into an array, and do a particular sql query when needed?

A: 

Your data structure looks about right. Your monitored users table is essencially an array, so you're offloading the data from the script to the database (where it should be).

You are probably looking for scraping to collect your data from eBay.

strager
+3  A: 

For collecting your data, using eBay's API would probably be easier than scraping.

As for the database structure, the most "proper" way to do it would be to have a users table with an id column (int, auto increment, primary key) as well as username and any other data you want to store for each user. Then have an auctions table for each auction, also with an id column and a user_id column and columns for other info you want to store. The id column creates a key value that will never change, so you can always refer back to the same data entity (user names and auction titles can change).

CodeMonkey1