Jump to content

mikethecoder

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mikethecoder's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. On part of a site I am working on, I need to generate a random code such as "HG877JHSA6S778DFF" for example. I will store the code in a field in the database. The problem is that when I need to create a new random code for when this event happens again, they can not be duplicated. What is the best way to do this? Obviously I could just generate the code, query the database and look for more than 1 result, if so then generate a new one and check that and repeat, or if it doesn't already exist commit it to the database. But this table may eventually grow very very large and I was wondering if generating a code and querying that one value against the whole table is really the most efficient way to do this. Any other better ways/setups out there? Thanks!
  2. So here is my problem... I work at a company helping do automotive/vehicle websites... a particular dealer wants to build a new search page that will search through vehicle options and equipment. The options are actually sent to us each night in a data feed and imported into the database. The database basically has an OPTIONS table... the fields are basically just "option" and "vin"... so an example of the db would be: VIN | OPTION ----------------------------- 72838723HHD | Cd changer 6disc 72838723HHD | halogen headlights 72838723HHD | Car bra included 11111929J323 | 4 disc cd changer The problem is that we don't control the option data since it is sent to us from another company. A cd player could be listed in 100 different ways across the vehicles of a particular dealer. They want a search page where we would list things like "CD Player" and a checkbox to search for cars with that option. I was just wondering if anyone has any advice on the best way to do this or if they have done anything similar. I am guessing for the checkbox values I would just have general keywords and use a lot of SQL LIKE commands... maybe if they check cd player it would add to the SQL "where option like '%cd%' and option like '%cd player%'" or something like that. They also want to have a page where it shows all the options and in parenthesis show how many matching cars for each option. Just wanted some thoughts from experience here. Thanks everyone!
  3. users can make accounts and submit a post. the posts will then be showed on a main page with their content being driven by the database made from those user inserts.
  4. I have a web site that has several postings each day and I want to have a score next to each one. Every user can vote just one time and it will put the score up one point or down one point so users can get an idea for which are the best postings to view. Anyone visiting the site can vote, not just members. What is the easiest way to track to make sure that voting only occurs once. Should this be something stored in the dB or should I use cookies or what? Actually, look at www.urbandictionary.com and see their thumbs up and down rating system. That is basically what I want. I can ignore the on the fly score change though. I have an iframe on my web site so that when the user clicks the link to give it a rating, the script will run in the iframe to increase the counter. So yeah, how can I accomplish this? Thanks.
  5. But is the database setup I showed efficient or is there a better way to create the database? I mean, what do some of the major sites out there like facebook use I wonder... The way I created the database with the friendowner and slave... if the site was to become huge... wouldnt that slow down everything scanning a table with hundreds of thousands of rows... one for each friend relationship. Im wondering if there is a better way to do this moreso in terms of the db setup versus accessing the data.
  6. Okay so I have to create a decent sized virtual community online. Users will have profiles and can add other users on a "friend list". We all have seen this before. My question is what is the best way to program this in PHP? And also how should the database table for the friend list be structed? I was thinking have a table called friendlist and it would have a unique id for the primary key and then a field called "friendowner" and "slave" or something to that effect where both friends are foreign keys to the user table. ID - Friendowner - Slave 1 - 5 - 43 1 - 5 - 54 So when the user whose id is 5 loads his profile it will show him having 2 friends whose id's are 43 and 54. But is this the best way to go? Lets say we have a site with 100k members and each member has 300 friends... that table would be huge. And the time it takes to search the table worries me. I suppose this is where caching could come in handy but still. Is there a more effective way? And could any type of indexing help?...I was thinking no since the fields will only consist of just numbers so its already sweet and to the point... just, a lot of data to sift through. Please any help would be greatly appreciated!!! Thank you all!
  7. Okay so I have to create a decent sized virtual community online. Users will have profiles and can add other users on a "friend list". We all have seen this before. My question is what is the best way to program this in PHP? And also how should the database table for the friend list be structed? I was thinking have a table called friendlist and it would have a unique id for the primary key and then a field called "friendowner" and "slave" or something to that effect where both friends are foreign keys to the user table. ID - Friendowner - Slave 1 - 5 - 43 1 - 5 - 54 So when the user whose id is 5 loads his profile it will show him having 2 friends whose id's are 43 and 54. But is this the best way to go? Lets say we have a site with 100k members and each member has 300 friends... that table would be huge. And the time it takes to search the table worries me. I suppose this is where caching could come in handy but still. Is there a more effective way? And could any type of indexing help?...I was thinking no since the fields will only consist of just numbers so its already sweet and to the point... just, a lot of data to sift through. Please any help would be greatly appreciated!!! Thank you all!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.