You are here: Re: How can you pull a random item and leave that item on site for a specified time period? « PHP Programming Language « IT news, forums, messages
Re: How can you pull a random item and leave that item on site for a specified time period?

Posted by Krustov on 10/01/07 18:12

<comp.lang.php>
<itcassy>
<Mon, 01 Oct 2007 17:56:53 -0000>
<1191261413.250677.48280@d55g2000hsg.googlegroups.com>

> Thanks for the quick response! However, I am not sure this will work.
> Maybe I can clarify... I want the page to automatically choose a
> different dealer to display automatically every week. Just like a
> random sort except not every time you load the page, I only want the
> code to choose a new dealer every week. If I save the temp time to
> the db, it would only work once (?) for the first week? Please
> correct me if I am not following....
>

Yes i know what you want - but theres no way for anybody but yourself to
know how much or how little php skills you have - some people only need
a pointer and some people need more help .


At the end of the week - just repeat the $temp process to pick another
dealer to be shown - then repeat again the next week etc .

Assuming you have 50 dealers .....

$batman=(rand()%50);

This will pick a number between 0-49

If dealer number 22 is picked then store dealers name No. 22 in the
database or a flat file .

Then retrieve the dealers name from the database or flat file anytime
the index.php is loaded - and anytime it does this - then check the
$temp to see if its older than one week old .


--
www.vhit.co.uk

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация