Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Best way to do this in mysql
Old 01-29-2009, 05:59 PM Best way to do this in mysql
Defies a Status

Posts: 1,605
Trades: 0
I want to add a table to an existing database to enable a ratings script and to track which IP has voted for each item. The only information I need in this table are:
the id of the item
the ip numbers that voted for this item

Each item id number will be unique as that is pulled from another table. Each id number will have multiple ip numbers voting for it.

If I only have two fields ID and IP then there will be multiple entries for each ID. Make the Ip the primary key and index the item number?

Is this the best way to do this? Looking for speed and ease on the server.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-29-2009, 08:23 PM Re: Best way to do this in mysql
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
I'd go to two tables,

One for IPs (plus an ID column), indexed on the IP column, and a relational table of item IDs and IP IDs
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-29-2009, 09:15 PM Re: Best way to do this in mysql
Defies a Status

Posts: 1,605
Trades: 0
I may try that. What I posted above did not work.

Right now I have a single table with id and ip, indexed on id with no primary and I can post with multiple (faked for testing ) IPs. But this is going to become a long table on a popular site as each entry is a seperate row.

Maybe that isn't as bad as it sounds since the select process is where id and ip = the designated items.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Best way to do this in mysql
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11533 seconds with 12 queries