CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Tip of the day problem

Print topic Send  topic

Author Message
Karen
Posted: 03/03/2003, 12:40 AM

I'm trying to display a random record for each day as a tip of the day thing. I have no problem selecting a random record but how do I also select the record that has been displayed for the day already? Here's what I've done so far.

I've created a table with the tips and date. The tips are then selected randomly (using custom SQL) and one is displayed in the grid type form. At the same time, in the Before show event, I update the date field to today's date.

Now the problem is for the same day, I don't need to select randomly again. I just need to select the record that matches today. I'm not sure how to put this condition into the custom SQL.

So basically here's what I need to do, I have 2 select statements. I will only execute the second if the first does not return any results. Can anyone tell me how to go about this? Or I'm not going about it the correct way in the first place. Pls help!
folkerts
Posted: 03/03/2003, 1:20 AM

You could use a xtra field in your table TipOfDay call this field last_used. When someone hits your page your script starts searching for a tip of the day where date last_used is today. if this query return Null you should make a tip of the day. This way you cann make sure the same tip isnt displayed within a week off lastused etc.

have fun

folkerts

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.