ส่วนโค้ดค่ะ
<style type="text/css">
<!--
body {
background-color: #FF9900;
}
-->
</style><?
$correct=0;
$total=count($total_question);
include "connect.php";
$sql="select id,answer from tb_test order by id";
$result=mysql_db_query("$dbname",$sql);
while ($r=mysql_fetch_array($result)) {
$id=$r[id];
$answer=$r[answer];
if (in_array($id, $total_question)) {
$select="select_".$id;
if (${$select}==$answer) {
$correct++;
}
}
}
$link=mysql_connect("localhost","root","root");
if (!$link)
{
print("ERROR");
}
else
{
mysql_select_db("db_test",$link);
$sql="insert into tb_member (id,username,score_mid)
values ('$id,$username,$correct')";
$res = mysql_query( $sql , $link );
if ($res==1)
print("Adding to table OK.");
else
print("Error Adding to table. ");
}