问题描述
我有一个关于如何在数据库中保存总分值的问题
这里是我的代码:
$ answer1 = $ _POST ['q1'];
$ answer2 = $ _POST ['q2'];
$ answer3 = $ _POST [ 'q3'];
$ answer4 = $ _POST ['q4'];
$ answer5 = $ _POST ['q5'];
$ totalCorrect = $ _POST ['得分'];
$ totalCorrect = 0;
if($ answer1 ==B){$ totalCorrect ++; }
if($ answer2 ==A){$ totalCorrect ++; }
if($ answer3 ==C){$ totalCorrect ++; }
if($ answer4 ==D){$ totalCorrect ++; }
if($ answer5 ==D){$ totalCorrect ++; }
echo
i have a problem on how to save the value of the total score in database
here is my code:
$answer1 = $_POST['q1'];
$answer2 = $_POST['q2'];
$answer3 = $_POST['q3'];
$answer4 = $_POST['q4'];
$answer5 = $_POST['q5'];
$totalCorrect = $_POST['Score'];
$totalCorrect = 0;
if ($answer1 == "B") { $totalCorrect++; }
if ($answer2 == "A") { $totalCorrect++; }
if ($answer3 == "C") { $totalCorrect++; }
if ($answer4 == "D") { $totalCorrect++; }
if ($answer5 == "D") { $totalCorrect++; }
echo "
;
如何在我的数据库中保存$ totalcorrect中的数据?
可以帮助我解决这个问题吗?提前谢谢
我尝试了什么:
i'我试图在网上搜索,但我无法得到答案。
";
how can i save the data in $totalcorrect in my database?
can some one help me fix this? Thank you in advance
What I have tried:
i've tried to search online but i cant get the answer.
推荐答案
这篇关于如何将这些数据保存到mysql数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!