如何将这些数据保存到mysql数据库? [英] How to save this data to mysql database?

查看:148
本文介绍了如何将这些数据保存到mysql数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于如何在数据库中保存总分值的问题



这里是我的代码:



$ 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 / 5 correct
$totalCorrect / 5 correct

;





如何在我的数据库中保存$ 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.

推荐答案

answer1 =
answer1 =


_POST ['q1'];
_POST['q1'];


answer2 =
answer2 =


这篇关于如何将这些数据保存到mysql数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆