RE: [PHP] random generation

From: Date: Wed, 18 Oct 2000 02:27:49 +0000
Subject: RE: [PHP] random generation
Groups: php.general 
Request: Send a blank email to php-general+get-20756@lists.php.net to get a copy of this message
Right, I use something like this at www.j-door.com/experts.html if you select a populated area there (like recruiting/executive search) you'll see that the items are rotating randomly (play with refresh button)... however if you select an item, the rotation freezes, and that's possible only with PHP, you cannot do it with MySQL's rand(), since you have to remember the array's order and reuse it again. (at least I don't know how,.. can I?) Cheers! -----Original Message----- From: Matthew Leingang [mailto:leingang@math.rutgers.edu] Sent: Tuesday, October 17, 2000 10:06 PM To: Maxim Maletsky Cc: 'Kapil Bodhankar'; 'PHP General List. (E-mail)' Subject: RE: [PHP] random generation I like this idea, because then you can make that array of "remaining questions" a session variable. Each time you load the page, you array_shift() off a number from the array and display that problem. Now the array has one less number in it. When are you done? When the array is empty! This might even be better than selecting 60 random records from the database, because you said you only want to display them one at a time. ---------------------------------------------------------------- Matthew Leingang http://www.math.rutgers.edu/ Rutgers University leingang@math.rutgers.edu Department of Mathematics "This signature needs no quote." On Tue, 17 Oct 2000, Maxim Maletsky wrote: > Rand() works only from MySQL vs. *23* > > you could create a code in PHP to do it, it generates a random array of > numbers which you can then use as a pointer to get your results from the > database. > > -----Original Message----- > From: Kapil Bodhankar [mailto:kapil@archeanit.com] > Sent: Tuesday, October 17, 2000 2:24 PM > To: php-general@lists.php.net > Subject: [PHP] random generation > > > hi guys, > i would like to get random questions displayed for my online > examination.how do i get them displayed.i want to get 60 questions > displayed randomly one after the other whenever i reload a page. > infact i tried this: > select * from questions order by Rand(); in Mysql, > but this doesnot work. is there any other way to do it? > -- > Kapil > Web Developer > kapil@archeanit.com > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > [ Part 104: "Included Message" ] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#20756) next »