Learn to Design a PHP Quizzer using PHP and MySQL - Part 5

  Рет қаралды 20,388

Eduonix Learning Solutions

Eduonix Learning Solutions

Күн бұрын

Пікірлер: 88
@rickallenmagbanua2819
@rickallenmagbanua2819 7 жыл бұрын
Great tutorial. I'd like to ask on HOW TO SAVE THE SCORE INTO THE DATABASE?
@SomoyeTosin
@SomoyeTosin 7 жыл бұрын
You are really doing a great work sir, this has really helped me. Please sir, is it possible to have my question come in random? I have been able to make choices for each question be randomize but I will like the question come in random sir. Hope you reply soon sir.
@kdford2057
@kdford2057 6 жыл бұрын
Is it possible to use images as choices? Thank you
@keithpogzkeithpogzosu1250
@keithpogzkeithpogzosu1250 4 жыл бұрын
great video sir! May i ask of how to connect this to a login page?
@sonalkakkar2961
@sonalkakkar2961 7 жыл бұрын
Hi, thanks a lot for these awesome tutorials..But i have a doubt in this, i followed the same as you did but when i am hitting submit button, my page is not redirecting to the next question, it remains there only,. also i did echo $number and $selected_choice and i am getting only selected choice not the numnber like this Array ( [choice] => 4 [number] => ) ypu cam see there is no number displaying. Please help me as soon as possible..thanks n advance
@ravishankarps2075
@ravishankarps2075 7 жыл бұрын
make sure that this line in question.php is correct because i also got the same error
@TobiasPalludan
@TobiasPalludan 7 жыл бұрын
Awesome tutorial. It was great to see you debug and how you went about it. One note though: If you take this quiz multiple times, the score will be added upon the previous results because the session is still active. I fixed the result by adding session_destroy(); to the end of final.php. I don't know if this is the best approach though.
@TobiasPalludan
@TobiasPalludan 7 жыл бұрын
To add to my own comment. I changed my approach, and in process.php I started by checking, if the number was 1 and then reset the score. To do that I did the following: After if($_POST) we get the number in $number = $_POST["number"]; (line 10 in the video) After this line I simply added: if($number == 1) { $_SESSION["score"] = 0; } Now there's no need to have the session_destroy(); in the final.php, as that will not make it possible for the user to update the final page without loosing their score. Cheers :)
@vishalsinghshekhawat6388
@vishalsinghshekhawat6388 7 жыл бұрын
how fix this problem "fixed the result by adding session_destroy(); ",what i do .....please tell me sir again
@TobiasPalludan
@TobiasPalludan 7 жыл бұрын
Vishal Vishal did you do what I mentioned in my own response? You essentially reset the score when you start the quiz
@vishalsinghshekhawat6388
@vishalsinghshekhawat6388 7 жыл бұрын
sir when i take a quiz multiple times,score added upon the previous result ....i want solve this problem, what is code to write in final.php....please
@vishalsinghshekhawat6388
@vishalsinghshekhawat6388 7 жыл бұрын
m waiting your answer sir
@giftmusanza9205
@giftmusanza9205 4 жыл бұрын
if the $_SESSION['score'] is still incrementing, destroy the session when you get to final.php. Add this to final.php as shown in the source code
@kennaawaaqayyoo4852
@kennaawaaqayyoo4852 4 жыл бұрын
pls can you do this using recent php mysqli and pdo method?
@furqanparvez2650
@furqanparvez2650 6 жыл бұрын
I was wondering what would need to be done in order to record the answers selected by the user, i.e. like storing the results in a table for each time it has been completed. Kind of like a survey, keeping a tally of how many times an answer has been chosen?
@eduonixsupport1889
@eduonixsupport1889 5 жыл бұрын
Please refer the link mentioned below for getting an idea about your query. www.sitepoint.com/community/t/how-do-you-submit-quiz-scores-to-database-table/110443
@robertokakur4996
@robertokakur4996 2 жыл бұрын
Yo did you manage to do it and could you mabye send me the code, would apreciate it :)
@demian5511
@demian5511 6 жыл бұрын
If anyone has a problem with score after repeating the quiz, possible solution is to reset the score if clicked on a " repeat " button, and redirect to questions.php?n=1 : if(isset($_POST['repeat'])){ $_SESSION['score'] = 0; header('Location: questions.php?n=1'); } Don't know if it is the best approach but it works!
@demian5511
@demian5511 6 жыл бұрын
So you don't have to destroy session.
@Eduonix
@Eduonix 6 жыл бұрын
Thank you for your valuable input, Demian. We hope it helps other students. Subscribe for more updates!
@invsg5072
@invsg5072 3 жыл бұрын
How do you include 'n' in the URL?
@維馨郎
@維馨郎 4 жыл бұрын
Can you help me fix the problems? Notice: Trying to access array offset on value of type null in D:\xampp\htdocs\aaaa\quiz\question.php on line 68 of 5 Notice: Trying to access array offset on value of type null in D:\xampp\htdocs\aaaa\quiz\question.php on line 70 Notice: Undefined index: score in D:\xampp\htdocs\aaaa\quiz\final.php on line 37 Also, I cannot switch questions while I press the button.
@moxlofi
@moxlofi 4 жыл бұрын
having the same issue. Did you manage to figure it out?
@nickobalute6656
@nickobalute6656 7 жыл бұрын
can you create quiz with timer?
@Eduonix
@Eduonix 7 жыл бұрын
Sure, Nicks. We will try to do it in our next tutorials. Subscribe us to get updates on latest courses.
@robertokakur4996
@robertokakur4996 2 жыл бұрын
Sir how do i save the Iteration from the right answers in a Database?
@vishalsinghshekhawat6388
@vishalsinghshekhawat6388 7 жыл бұрын
sir u please read my problem- i create 3 quiz- i select right choice of 1 quiz and submit then get number = 1 now m on 2nd quiz i select right choice and submit then i get total number=2 now m on 3rd quiz but.. now if i back again on 2nd quiz, again select right choice and submit now total get number = 3 (this is my problem) now again on 2nd quiz,again select right choice and submit same then get number=4 again same then get number = 5....... now 3rd quiz select right choice and submit then get total number = 6 how solve this problem sirrr....
@pocong7ganu
@pocong7ganu 7 жыл бұрын
read the top comment.. After if($_POST) we get the number in $number = $_POST["number"]; (line 10 in the video) After this line I simply added: if($number == 1) { $_SESSION["score"] = 0; } Now there's no need to have the session_destroy(); in the final.php, as that will not make it possible for the user to update the final page without loosing their score.
@patrickjohnobsina4599
@patrickjohnobsina4599 6 жыл бұрын
Hi sir! Thank you for that tutorial, I have an error that the score keeps increasing and when i refreshing it, it keeps increasing more. why is that happening?
@eduonixsupport1889
@eduonixsupport1889 6 жыл бұрын
You can download the resource file from the s3.amazonaws.com/edu-resources/Projectsin-PHPand-MySQL/resource-AddQuestionForm.zip.
@sirius8ly
@sirius8ly 5 жыл бұрын
Hello. Did you ever get this figured out? I am still running into the same problem even though I copied his code.
@imanechakri4290
@imanechakri4290 4 жыл бұрын
@@sirius8ly same thing here can u help me
@sirius8ly
@sirius8ly 4 жыл бұрын
@@imanechakri4290 Hello imane. Sorry. He is so busy I don't think he has time to check these messages. I never could get it to work so I moved on to other projects. Sorry I couldn't be more helpful.
@secundatime7447
@secundatime7447 2 жыл бұрын
​@@sirius8ly Hey if you're still wondering how to do it I managed to fix it by adding onClick="" so like:
@維馨郎
@維馨郎 4 жыл бұрын
Can you help me fix the problem? When I press the submit button, the url doesn't change, thus the question didn't go to the next one. thank you
@baburamchaudhary159
@baburamchaudhary159 6 жыл бұрын
I follow you completely but I get offset that I am not being able to fix the error: Notice: Undefined index: number in C:\xampp\htdocs\quizzer\process.php on line 17 Array ( [choice] => 3 ) you have also got error at: 7:43 minutes how to fix it ... Please help me sir
@angelcruz-ny4yy
@angelcruz-ny4yy 6 жыл бұрын
Whare can i find the github repo for this video ? i'm having a error with process.php
@eduonixsupport1889
@eduonixsupport1889 6 жыл бұрын
You can download the resource file from the dashboard. s3.amazonaws.com/edu-resources/Projectsin-PHPand-MySQL/resource-ProcessAnswers.zip and s3.amazonaws.com/edu-resources/Projectsin-PHPand-MySQL/resource-AddQuestionForm.zip
@pianoLee-sx9dx
@pianoLee-sx9dx 6 жыл бұрын
I am just wondering why the isset function does not work here whereas it does work in my login page and I have the same thing that you have...
@eduonixsupport1889
@eduonixsupport1889 6 жыл бұрын
You can download the resource file from the s3.amazonaws.com/edu-resources/Projectsin-PHPand-MySQL/resource-AddQuestionForm.zip
@pianoLee-sx9dx
@pianoLee-sx9dx 6 жыл бұрын
I finally got it working and it was my fault though... thanks for the tutorial! Just wondering, for some reason, I can't get it to work if I am using $resultcheck= mysqli_num_rows($result); I don't know why... it says something about boolean given error...
@ravishankarps2075
@ravishankarps2075 7 жыл бұрын
I have 2 questions in my db and when i click the submit button the url gets incremented "questions.php?n=2" but it says object not found help me please
@tahiraziz1
@tahiraziz1 7 жыл бұрын
same error kya kru
@eduonixsupport1889
@eduonixsupport1889 7 жыл бұрын
header("Location:question.php?n=".$next);Check this line of process.php . Check your question.php file name is same as written in above line code .
@RezaJafari1984
@RezaJafari1984 6 жыл бұрын
After refreshing the final page this message showing :Notice: Undefined index: score in C:\xampp\htdocs\quizzer\final.php on line 25
@eduonixsupport1889
@eduonixsupport1889 6 жыл бұрын
You can refer link. to download the resource file from the dashboard.s3.amazonaws.com/edu-resources/Projectsin-PHPand-MySQL/resource-ProcessAnswers.zip
@dinaprakash5145
@dinaprakash5145 5 жыл бұрын
The score is getting incremented(with old score) continuously everytime I rerun the quiz. How to resolve it!?
@rikiyang3003
@rikiyang3003 4 жыл бұрын
add this code at the end of final.php
@keithpogzkeithpogzosu1250
@keithpogzkeithpogzosu1250 4 жыл бұрын
@@rikiyang3003 thanks alot
@MovieHeretic
@MovieHeretic 7 жыл бұрын
Well that was weird, changed $_SESSION['score']++ to $_SESSION['score']+1; and the session variable didn't get increased by 1????
@eduonixsupport1889
@eduonixsupport1889 7 жыл бұрын
Try this. $_SESSION['score'] = $_SESSION['score'] + 1;
@parasramshinde7321
@parasramshinde7321 6 жыл бұрын
its not going to second question page
@eduonixsupport1889
@eduonixsupport1889 6 жыл бұрын
You can refer link. to download the resource file from the dashboard.s3.amazonaws.com/edu-resources/Projectsin-PHPand-MySQL/resource-ProcessAnswers.zip
@ganeshpathak8003
@ganeshpathak8003 7 жыл бұрын
how to check the answer... ??
@eduonixsupport1889
@eduonixsupport1889 7 жыл бұрын
Please describe your question?
@fullclubmix
@fullclubmix 7 жыл бұрын
Line 19 error? $results = $mysqli->query($query) or die ($mysqli->error.__LINE__); Undefined variable: mysqli in C:\........ on line 19 Fatal error: Call to a member function query() on null in C:\.........on line 19 help.
@eduonixsupport1889
@eduonixsupport1889 7 жыл бұрын
Use $result instead of $results
@fullclubmix
@fullclubmix 7 жыл бұрын
same error I followed the tutorial until the end if it works only that error is the only one.
@unfoldingcode
@unfoldingcode 6 жыл бұрын
you are supposed to use another sql version....
@rajankumar-fr2df
@rajankumar-fr2df 6 жыл бұрын
use $mysqli instead of $conn in database connection(database .php file)
@VikramSingh-xw7tl
@VikramSingh-xw7tl 6 жыл бұрын
Send me source code
@Eduonix
@Eduonix 6 жыл бұрын
Hello Vikram !! find the source code: github.com/eduonix/PHPQuizzerusingPHPandMySQL.git
Learn to Design a PHP Quizzer using PHP and MySQL - Part 6
23:27
Eduonix Learning Solutions
Рет қаралды 22 М.
Learn to Design a PHP Quizzer using PHP and MySQL - Part 4
21:11
Eduonix Learning Solutions
Рет қаралды 24 М.
World’s strongest WOMAN vs regular GIRLS
00:56
A4
Рет қаралды 29 МЛН
小丑揭穿坏人的阴谋 #小丑 #天使 #shorts
00:35
好人小丑
Рет қаралды 46 МЛН
龟兔赛跑:好可爱的小乌龟#short #angel #clown
01:00
Super Beauty team
Рет қаралды 136 МЛН
这是自救的好办法 #路飞#海贼王
00:43
路飞与唐舞桐
Рет қаралды 122 МЛН
Learn to Design a PHP Quizzer using PHP and MySQL | Part 2 | Eduonix
13:20
Eduonix Learning Solutions
Рет қаралды 20 М.
How to Design a Database
10:57
Database Star
Рет қаралды 67 М.
Save HTML Form Data to a MySQL Database using PHP
24:38
Dave Hollingworth
Рет қаралды 210 М.
Learn to Design a PHP Quizzer using PHP and MySQL | Eduonix
22:32
Eduonix Learning Solutions
Рет қаралды 42 М.
7 Database Design Mistakes to Avoid (With Solutions)
11:29
Database Star
Рет қаралды 84 М.
Learn to Design a PHP Quizzer using PHP and MySQL - Part 3
8:22
Eduonix Learning Solutions
Рет қаралды 15 М.
Signup and Login with PHP and MySQL
43:16
Dave Hollingworth
Рет қаралды 287 М.
World’s strongest WOMAN vs regular GIRLS
00:56
A4
Рет қаралды 29 МЛН