Id stick with ID and tip, pull a random one each time and cache the query for 24 hours.

as for dates, I like to break them into to 3 parts when using a form to enter them..
form.Date_Day, form.Date_Month, and form.Date_Year

then piece them back together in a cfset to get the date. while catching bad dates like feb 30 or something. The CreateODBCDate () will throw an error if it is a bad date

<cftry>
    <cfset thedate = form.date_month & "/" & form.Date_Day & "/" & form.date_Year>
    <cfset TheDate = CreateODBCDate(thedate)>
    <cfcatch>
    INVALID DATE
    </cfcatch>
</cftry>

make sense?

  ----- Original Message -----
  From: Daniel Kessler
  To: CF-Talk
  Sent: Tuesday, August 03, 2004 10:53 AM
  Subject: tip of the day

  I'm looking for either advice or tutorials on creating a "tip of the
  day" database.  Here are the ways that I thought up.  I am working in
  Oracle.

  1 - Have just two fields, ID#s and Tips.  Set up some Oracle process
  that each day at 12 A.M., local server time chooses another TIP
  either the next one in the row, or a random one.  I guess if it were
  a random one, it'd have to have another field for "chosen".  If it
  were the next one in the row, it'd have to loop after it ran out of
  rows.
  My reluctance is that I am new to DBs, especially Oracle and when
  I've tried to set up other processes, it's hasn't worked smoothly
  (couldn't get a trigger to work) and I end up spending days trying to
  make it work.
  This option seems the cleanest to me.

  2 - Have three fields: ID#s, Tips, dateAdded.   Get the date for the
  oldest tip.  Find out how many days since that tip (say it's 419).
  Do a MOD on number_of_days/number_of_rows to find the position of the
  next tip (ie 419 MOD 82 = 9, so tip 9).   This seems fine in theory
  to me, but I've not implemented it to see what trouble it'll give me.
  Nonetheless, I think it's a cool idea :-).

  3 - Also have the datePresented field and have the display date
  entered by a form.  I don't like this because it invites error and
  more management of information.

  So any help would be appreciated, either general thoughts on this or
  my ideas or some tutorials.

  thanks.

  --
  Daniel Kessler

  Department of Public and Community Health
  University of Maryland
  Suite 2387 Valley Drive
  College Park, MD  20742-2611
  301-405-2545 Phone
  www.phi.umd.edu
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to