Jump to content

Federal

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Federal's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Wait, I'm an idiot. I'm already doing SELECT *, so I can suss it out using PHP anyway. Durrr.
  2. Suppose I have a table as follows: ID VAR1 VAR2 VAR3 01SundayPortland 11TuesdayThe Hague 20FridayOttawa 31MondayBangkok I'd like to set it up so that, if VAR1 = 1, it returns VAR2, while if VAR1 = 0, it returns VAR3. Is this possible using mySQL alone, and without adding additional tables? I can work out a PHP-based solution involving seperating them into different tables (VAR1 on one table, VAR2 and VAR3 on another), but that would be inefficient. Edit: mySQL 5.0
  3. Ahoy! I'm trying to code a tournament registration system. Long story short, a component of registration is a lottery; I've got more entrants than I do competition berths, so I need to pick 40 records at random from a MySQL database, with no duplication. I'm aware that there are other, non-PHP-based systems to do this, but I'd like to turn this into a learning experience if at all possible. :) Speaking of possible... is it possible? What I'm currently toying with: - Add a "selected" field to the database, default "no". - Have it pick a random number between 1 and however many, and call up the database record attached to that number. - If that record is already toggled as selected, toss it back and roll again. If it isn't, toggle it to "yes", and roll again until you hit 40. Would this work? I'd be running the script on IBserver, so bandwith and server drain isn't a concern.
×
×
  • 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.