I can't say for sure, but I would imagine that you can use MySql triggers to
do this. It would have the advantage that it only happens once a day, and at
the time you want it to happen - maybe someone with more experience of these
things can help.
 If it isn't possible, then it would be quite easy to add some code
(preferably an include()) in your script. It would have to check a field
which stored the last date the number was changed, and if the current time
had passed the time when you want the number to change AND the last-changed
date was not today, then you would create a new number and store it. The
script would then (in any circumstances) retrieve the stored number and use
it as you will. This, of course, has the overhead of a DB call every time
the script is run.
 Ideally, of course, if you can do it, then you would schedule a cron task
or a Windows Scheduler task or a MySql trigger to do it at the assigned
time. If yu don't have complete control of the server, then these options
might not be available to you - it still might be worth contacting your
hoster and explain the situation - they are not all sysadmins-from-hell and
usually are persuadable. They turn these things off because they don't want
punks playing around with them - explain your case, and they might well be
quite reasonable. See it from their point of view - we're all control freaks
:-)
 Ian

 On 15/11/05, Pete <[EMAIL PROTECTED]> wrote:
>
> In message <[EMAIL PROTECTED]>, viewcharts <[EMAIL PROTECTED]>
> writes
> >If I put the number in the database table, how do I select the next
> >number based on the date?
>
> If you choose the time to change the number as midnight, it would be
> simpler. If the "ChangeTime" is not midnight, then you have to check
> the time as well as the date, but, anyway...
>
>
> I wouldn't put it in a database. Although I use a lot of databases, I
> wouldn't in this case.
>
> I would write code into the page, that the page should read the text
> file, which contains the date, and the number.
>
> If the date read is not 'today', then create a new number, then write
> the new date and number to the text file.
>
> NOW you can use and display the number, whether it was changed or not.
>
> >> I would like my webpage to show one number each day.
> >> The number will be
> >> randomly selected at a certain time of the day. Is it
> >> possible to do
> >> this by php? I do not want to have to go to the
> >> webpage and update it,
> >> and I want the randomly selected number to remain on
> >> the webpage until
> >> the next day when a new random number will display.
> >>
> >>
> >> Thanks,
> >> Wes
>
> --
> Pete Clark
>
> http://www.hotcosta.com
> http://www.spanishholidaybookings.com
>
>
>
>
> Community email addresses:
> Post message: php-list@yahoogroups.com
> Subscribe: [EMAIL PROTECTED]
> Unsubscribe: [EMAIL PROTECTED]
> List owner: [EMAIL PROTECTED]
>
> Shortcut URL to this page:
> http://groups.yahoo.com/group/php-list
>
>
>
> SPONSORED LINKS
>   Php 
> mysql<http://groups.yahoo.com/gads?t=ms&k=Php+mysql&w1=Php+mysql&w2=Job+postings&c=2&s=33&.sig=FLGkJVBUdDMln4PBO26sng>
>  Job
> postings<http://groups.yahoo.com/gads?t=ms&k=Job+postings&w1=Php+mysql&w2=Job+postings&c=2&s=33&.sig=cV3rp9pSpCxahJy7imon_w>
>  ------------------------------
> YAHOO! GROUPS LINKS
>
>
>    - Visit your group "php-list<http://groups.yahoo.com/group/php-list>"
>    on the web.
>     - To unsubscribe from this group, send an email to:
>    [EMAIL PROTECTED]<[EMAIL PROTECTED]>
>     - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>    Service <http://docs.yahoo.com/info/terms/>.
>
>
>  ------------------------------
>


[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/HKFolB/TM
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: php-list@yahoogroups.com
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to