|
 |
|
สอบถามปัญหาคำสั่ง ในการเก็บคำสั่งการทำข้อสอบไม่สามารถไปบทต่อไปได้ |
|
 |
|
|
 |
 |
|
ผมว่าตรวจสอบเงื่อนไขดีๆครับ อยู่ตรงนั้นแหละครับ  
|
 |
 |
 |
 |
Date :
2012-07-19 13:18:34 |
By :
slurpee55555 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ช่วยผมหน่อยครับผมแก้มา 4 วันแล้วยังไม่ได้หน่อยครับ ผมส่งสัยว่าเป็นตรงส่วนนี้หรือเปล่าไม่รุ้ครับ
รบกวนผุ้ที่มีความชำนาญด้วยคับ

แล้วก็เป็น code ตัวนี้ครับ
Code (PHP)
<?
$test=$_POST['test'];
if ($test==1){
//echo "<a href=\"chap_1.php\">";}?>
<?
//echo "<a href=\"test1.php\">"; ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap1.php">หน้าถัดไป</a>
<? }
elseif ($test==2){
echo "<a href=\"test1.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap1.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap2.php">หน้าถัดไป</a>
<? }//end if score
}
elseif ($test==3){
echo "<a href=\"test2.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap2.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap3.php">หน้าถัดไป</a>
<? }//end if score
}
elseif ($test==4){
echo "<a href=\"test3.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap3.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap4.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==5){
echo "<a href=\"test4.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap4.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap5.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==6){
echo "<a href=\"test5.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap5.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap6.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==7){
echo "<a href=\"test6.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap6.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap7.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==8){
echo "<a href=\"test7.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap7.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap8.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==9){
echo "<a href=\"test8.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap8.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap9.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==10){
echo "<a href=\"test9.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap9.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap10.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==11){
echo "<a href=\"test10.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap10.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap11.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==12){
echo "<a href=\"test11.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap11.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap12.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==13){
echo "<a href=\"test12.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap12.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap13.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==14){
echo "<a href=\"test13.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap13.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap14.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==15){
echo "<a href=\"test14.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap14.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap15.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==16){
echo "<a href=\"test15.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap15.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap16.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==17){
echo "<a href=\"test16.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap16.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap17.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==18){
echo "<a href=\"test17.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap17.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap18.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==19){
echo "<a href=\"test17.php\">";
if ($score<8){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap17.php">กลับไปเรียนใหม่</a>
<? }else{ ?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap18.php">หน้าถัดไป</a>
<? } //end if score
}
elseif ($test==20){
echo "<a href=\"test4.php\">";
if ($score<15){
?>
<img src="icon/arrow.gif" width="18" height="12" border="0"><a href="chap_1.php?cK=1">กลับไปเรียนใหม่</a>
<? }else{ ?><img src="icon/arrow.gif" width="18" height="12" border="0"><a href="detail_mem1.php?id=<?=$_SESSION['MEM_USER']?>">หน้าถัดไป</a>
<? } //end if score
}
?>
|
ประวัติการแก้ไข 2012-07-21 19:54:46
 |
 |
 |
 |
Date :
2012-07-19 20:07:29 |
By :
jumloon2005 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คือปัญมันคือ ผมเอาตัวเก่ามาทำต่อครับ ซึ่งของเดิมตัวนี้ผมทำแค่
- แบบทดสอบก่อนเรียน
- แบบฝึกหัดท้ายยททีี่1
- แบบฝึกหัดท้ายยททีี่2
- แบบฝึกหัดท้ายยททีี่3
แบบทดสอบหลังเรียนทั้งหมด
แต่ที่ผมเอามาทำใหม่คือ
ทำให้ได้ 18 บทน่ะคับ
ปัญหาก็เกิดตอนที่ผมแปลงจากแบบทดสอบหลังเรียนทั้งหมดมาเป็น
แบบฝึกหัดท้ายยททีี่4 น่ะครับหลังจากนั้นปัญหาก็เกืิดฃ่วงนี้ตลอดเลยครับ
ขอบคุณด้วยน่ะคับ สำหรับผุ้มีความรุ้และช่วยแนะนำ
|
 |
 |
 |
 |
Date :
2012-07-21 20:02:22 |
By :
jumloon2005 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พอจะมีใครช่วยผมแก้ปัญหาตรงนี้ได้บ้างไหมครับ ผมแก้มาหลายวันแล้ว เครียดจังเลยทำไม่ได้เลยครับจะหมดเวลาแล้ว
ที่จับใจความได้คือ
test4
<form method="post" name="form1" id="form1" action="showtotal.php" >
ตัวนี้ส่งค่ามาที่ showtotal ปัญหาอยู่หน้านี้หรือเปล่าครับ
ทำบทที่ 4 แล้วไม่ยอมไปต่อบทที่ 5 ให้อ่ะคับ จาก code ข้างต้นครับ
รบกวนด้วยครับ
|
 |
 |
 |
 |
Date :
2012-07-22 17:28:51 |
By :
jumloon2005 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พอจะมีใครแก้ปัญหาตรงจุดนี้ได้บ้างหรือเปล่าครับผมแก้จนสุดๆแล้วครับ ยังไม่ได้เลยวานผุ้รู้ที่ครับ
|
 |
 |
 |
 |
Date :
2012-07-23 13:56:40 |
By :
jumloon2005 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมไล่ code แล้วตรับใครพอจะบอกสาเหตุบ้างได้ไหมครับ ว่าทำไมไปบทอื่นต่อไม่ได้ ทั้งๆ ที่คะแนนผ่านพร้อมจะไปบทถัดไปน่ะครับ
|
 |
 |
 |
 |
Date :
2012-07-24 19:35:13 |
By :
jumloon2005 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จาก code ใน NO.2 แล้ว มีการตรวจสอบเงื่อนไข จากตัวแปร $test นะครับ เพราะฉะนั้น จากที่ผมได้ดู code ให้แล้ว
ปรากฎว่า test3.php ส่ง $test= 4 หน้าถัดไปก็จะไปที่ 4
test4.php ส่ง $test = 4 หน้าถัดไปก็จะไปที่ 4 (ก็เลยไม่มีการเปลี่ยนแปลง)
เพราะฉะนั้นแนวทางแก้ไขคือ
แก้ไขค่าจากไฟล์ที่ test4.php , $test5.php ,$test....php ของคุณใหม่นะคัรบให้ถูกต้อง โดยแก้ไขจากบรรทัดที่ 424
ดังนี้
Code (PHP)
<input name="answer[]" type="hidden" value="<?=$row_exam1['answer']?>"><input name="test" type="hidden" value="5">
ลองดูครับ
|
 |
 |
 |
 |
Date :
2012-07-28 14:13:49 |
By :
reekoong |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากครับ ตอนนี้แก้ได้แล้วครับ ขอบคุณมากครับ แต่ตอนนี้มีปัญหาตรงเรื่องคะแนนน่ะครับ
คือ ผลการแสดงคะแนนที่ทำ ผมลองทำไปแค่ 13 บท แต่คะแนนดันออกมาหมดเลย 18 บทตามนี้น่ะครับ


คือผมลองทำแค่ 13 บท แค่คะแนนออกมาหมาดเลยครับ
ลักษณะของ code ที่ใช้ครับ

<table width="96%" border="1" align="center">
<tr bgcolor="#99CC00">
<th width="4%" rowspan="2"><div align="center">ลำดับ</div></th>
<th width="46%" rowspan="2"><div align="center">ชื่อนักเรียน</div></th>
<th colspan="20"><div align="center">คะแนน</div> <div align="center"></div> <div align="center"></div> <div align="center"></div></th>
</tr>
<tr>
<th width="10%" bgcolor="#99CC00">ก่อนเรียน</th>
<th width="10%" bgcolor="#99CC00"><div align="center">บทที่ 1 </div></th>
<th width="10%" bgcolor="#99CC00">บทที่ 2 </th>
<th width="10%" bgcolor="#99CC00">บทที่ 3</th>
<th width="10%" bgcolor="#99CC00">บทที่<br>
4</th>
<th width="10%" bgcolor="#99CC00">บทที่<br>
5</th>
<th width="10%" bgcolor="#99CC00">บทที่<br>
6</th>
<th width="10%" bgcolor="#99CC00">บทที่<br>
7</th>
<th width="10%" bgcolor="#99CC00">บทที่<br>
8</th>
<th width="10%" bgcolor="#99CC00">บทที่<br>
9</th>
<th width="10%" bgcolor="#99CC00">บทที่<br>
10</th>
<th width="10%" bgcolor="#99CC00">บทที่<br>
11</th>
<th width="10%" bgcolor="#99CC00">บทที่<br>
12</th>
<th width="10%" bgcolor="#99CC00">บทที่<br>
13</th>
<th width="10%" bgcolor="#99CC00">บทที่<br>
14</th>
<th width="10%" bgcolor="#99CC00">บทที่<br>
15</th>
<th width="10%" bgcolor="#99CC00">บทที่<br>
16</th>
<th width="10%" bgcolor="#99CC00">บทที่<br>
17</th>
<th width="10%" bgcolor="#99CC00">บทที่<br>
18</th>
<th width="10%" bgcolor="#99CC00">หลังเรียน</th>
</tr>
<?
$sql="select * from member";
$rs=mysql_query($sql);
$i=0;
while($row=mysql_fetch_array($rs)){
$i++;
?>
<tr>
<td><div align="center"><?=$i?></div></td>
<td> <?=$row['mem_name']?></td>
<td><div align="center"><? if ($row['mem_pretest_value']!=0){ echo $row['mem_pretest_value']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?></div></td>
<td><div align="center"><? if ($row['mem_score1']!=0){ echo $row['mem_score1']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?></div></td>
<td><div align="center"><? if ($row['mem_score2']!=0){ echo $row['mem_score2']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?></div></td>
<td><div align="center"><? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?></div></td>
<td><div align="center">
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
</div></td>
<td><div align="center">
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
</div></td>
<td><div align="center">
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
</div></td>
<td><div align="center">
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
</div></td>
<td><div align="center">
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
</div></td>
<td><div align="center">
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
</div></td>
<td><div align="center">
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
</div></td>
<td><div align="center">
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
</div></td>
<td><div align="center">
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
</div></td>
<td><div align="center">
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
</div></td>
<td><div align="center">
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
</div></td>
<td><div align="center">
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
</div></td>
<td><div align="center">
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
</div></td>
<td><div align="center">
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
</div></td>
<td><div align="center">
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
</div></td>
<td><div align="center"><? if ($row['mem_score_post']!=0){ echo $row['mem_score_post']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?></div></td>
</tr>
<? }//end while ?>
<tr>
<td colspan="2" bgcolor="#CCCCCC"><div align="center">คะแนนเฉลี่ย</div></td>
<td bgcolor="#CCCCCC"> </td>
<td colspan="18" bgcolor="#CCCCCC"><div align="center">
<?
//$gg=33333.33444;
print number_format($gg,2,'.',',');
?>
</div></td>
<td bgcolor="#CCCCCC"><div align="center">
<?
print number_format($ww,2,'.',',');
?>
</div>
<div align="center"></div></td>
</tr>
</table>
มันน่าจะเกิดจากสาเหตุอะไรเหรอครับ
|
 |
 |
 |
 |
Date :
2012-07-29 14:17:06 |
By :
jumloon2005 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แก้ไข้แล้วครับ ปัญหาคือ
<? if ($row['mem_score3']!=0){ echo $row['mem_score3']; }else{ echo "ยังไม่ได้ทำข้อสอบ"; }?>
ตรง mem_score.....ผมไม่ได้เปลี่ยนตามครับ โทษที่ครับ 55
|
 |
 |
 |
 |
Date :
2012-07-29 15:58:10 |
By :
jumloon2005 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณครับ
|
 |
 |
 |
 |
Date :
2012-07-29 18:30:50 |
By :
jumloon2005 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|