I am making a quiz in PHP. I have many questions in my database, User will select the category, and the questions from that category will be displayed.
I have two questions regarding this:
Use sessions (Reference). at the very top of your php file type:
session_start();
and then you can use it as global variables unique to every user. For example:
$_SESSION['last_question_id'] = 3;
$_SESSION['score_so_far'] += 1; // increases score by one
etc.
Also, please be more specific with your problem, maybe post some code or specific situations.
PHP variables cannot be overridden by another user. They are unique for each user session, because each runs in its own copy of the script for that request.
Data in your Database can be overwritten by other users. If two users edit the same question at the same time, there´s no real way to predict which version will end up in the database. This is something your program will have to manage for itself.
No, the database will not be overwritten. For displaying questions one by one, you can use the following:
$content = apply_filters( 'the_content', $content );
If you want to display all the pages one by one, you can try using the function get_pages()
.
But then again, it depends on what "type" of PHP you are using.