Hey guys. Im just learning php. i know asp, and decided to learn php. anyway.
I need to select random records from a database. As all of you know, records can be deleted and whatnot, leaving gaps. I’m drawing somewhat of a blank on this, and I’m also new to all of php’s awsome functions.
Hello people! Im also new in php...and I have a problem :-s...so I beg you to help me if you can... Ive created a quiz with an mysql database …the quiz has 20 questions…and I want…everytime a user enters to take the quiz, all 20 questions to be showed random…not in the same order… If you can help me with a little piece of code…you will make me a happy man :-s… please help and sorry for my bad english
I should point out that using rand() in query is very slow. I tested it out this just a couple of days ago with 2+ million records, and it took 30+ seconds. A better way is to use php’s mt_rand ( min , max ) function, and then generate 5-10 random numbers, and then select those rows. Much much faster, especially if you have primary_key_id = ‘rand_num’ !