guyz i need help sa concept unsaon randomize amo question sa php guyz..we have a database na naay table na nag contain sa tanang quenstions...dayun we want na random ang pagawas niya sa page...heres the screen shot of what we want to be displayed
![]()
guyz i need help sa concept unsaon randomize amo question sa php guyz..we have a database na naay table na nag contain sa tanang quenstions...dayun we want na random ang pagawas niya sa page...heres the screen shot of what we want to be displayed
![]()
The server is good enough to store the amount of SESSION as an array data, as a list of QUESTION IDs(from database), in random order but not repeating.
Strict error trapping should be applied when it comes to USER negligence pressing back/forward/history buttons of the browser.
Last edited by dodie; 03-12-2010 at 11:04 PM.
dili madala ug shuffle brod?
very simple example:
$myques = array("How old?","Where you live?","Your course?");//your list of questions
$keys = array_keys($myques);
shuffle($keys);
foreach ($keys as $key)
{
echo $myques[$key];
echo "<br/>";
}
Session is use to store or preserve informations can be used in subsequent access to you web application. For example user authentication, once the user is successfully authenticated, his info is stored in the session so that he will never have to login again with in the lifespan of the session unless he logout. You should know about sessions and cookies...![]()
To keep the story short, the following are the BASIC FOUNDATIONS for your program.
read this please.
LINKS:
PHP: session_start - Manual
PHP: session_destroy - Manual
PHP: Arrays - Manual
PHP: mysql_fetch_assoc - Manual
I meant SESSION as an array data, containing only ID's.. which you can monitor with your program by itself.. and also to consume only tiny amount of space in the server's SESSIONs hidden storage.
You store the ARRAY data as part of the SESSION. With this, you have the complete control of the user and error trappings, whereever and whenever the user is messing with the browser buttons, forward/back/REFRESH.
You need a FLAG data or marker to monitor the user which question he/she is now. You need to practise more, CODE MANAGEMENT is hard when you are a new learner with PHP. You must create your own PROGRAMMING CONVENTIONS and variable namings to keep your program , Programmer friendly.
WARNING:
Don't ever load the entire words, strings, phrases of questionairs and choices into the SESSION, it is equivalent to SUICIDE
I warned you. hahahahaha![]()
APACHE server settings is limited to small amount of space for each user protocol. Too keep your development fast and safe, use XAMPP in your computer, develop it locally. ht t p://localhost/
Last edited by dodie; 03-16-2010 at 08:51 AM.
Similar Threads |
|