note 75162 added to function.rand

From: Date: Tue, 15 May 2007 17:33:37 +0000
Subject: note 75162 added to function.rand
Groups: php.notes 
Request: Send a blank email to php-notes+get-126624@lists.php.net to get a copy of this message
I don't know if this place is suitable for questions, but I have a problem. I want to create random function that will query a db to fetch a random row from a specific table. The problem is that I don't want this record to be so random. For example, I want to promote a specific banner (the table holds banner paths), so I don't want a specific banner to be displayed totally at random. Rather, I want a random rotation of the banners, but let's say every 2 mines, or 4-5 page refreshes, I would like to force the page display the banner I want to promote. A way to do that, would be to create another table storing the last 5 displayed banners, so, if none of the 5 is the specific one, I would force the banner to be the promoted one. But this seems a lot of work... (creating the table, quering it each time, etc). Isn't there any other way to do this without all these? Thanks for any answer, and sorry if this isn't the right place to post questions. ---- Server IP: 69.147.83.197 Probable Submitter: 87.202.121.159 ---- Manual Page -- http://www.php.net/manual/en/function.rand.php Edit -- https://master.php.net/note/edit/75162 Del: integrated -- https://master.php.net/note/delete/75162/integrated Del: useless -- https://master.php.net/note/delete/75162/useless Del: bad code -- https://master.php.net/note/delete/75162/bad+code Del: spam -- https://master.php.net/note/delete/75162/spam Del: non-english -- https://master.php.net/note/delete/75162/non-english Del: in docs -- https://master.php.net/note/delete/75162/in+docs Del: other reasons-- https://master.php.net/note/delete/75162 Reject -- https://master.php.net/note/reject/75162 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#126624) next »