symfony / propel with RAND()
Lately I am working on a simple online test system which doesn’t take up much of my to write the code from scratch. One of my favorite is using propel to generate the admin panel, it’s so easy, quick and code management is clean and neat.
i have a set of questions, for example 100 security related questions but some of the engineer may only need to answer 20 out of 100. And each engineer shouldn’t get the same question and using RAND() is easier for me in order to write – less code.
here is an example how you select random questions from database using propel;
$c = new Criteria();
$c->addAscendingOrderByColumn(‘rand()’);
$c->setLimit(20);
start having fun coding with symfony framework.