|
 |
|
มันไม่ insert ให้ค่ะ รบกวนช่วยดูให้หน่อยนะค่ะ ต้องการกรอกคะแนนแต่ละรายวิชา พอกดปุ่มบันทึกมันไม่ insert ให้ค่ะ |
|
 |
|
|
 |
 |
|
ต้องการกรอกคะแนนแต่ละรายวิชา พอกดปุ่มบันทึกมันไม่ insert ให้ค่ะ รบกวนช่วยดู code ให้หน่อยนะค่ะ

Code (C#)
<? include "config.php" ?>
<?php
if (isset($_POST['test'])){
mysql_connect('localhost','root','');
$n=1;
while(!empty($_POST['data'][$n]['scall'])){
$record = array_map('mysql_real_escape_string',$_POST['data'][$n]);
$s = "'".implode("','",$record)."'";
$query = "INSERT INTO scall(scallid,studentid,classroomid,roomid,subjectidid,education_part,academic_year,scall,grade) VALUES($s)";
$res = mysql_query($query);
if (!$res){
echo "\n<br />".mysql_error();
}
$n++;
}
}else{
}
?>
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" name="form1" id="form1">
<?php foreach(array(1) as $n): ?>
<?
for($i=0;$i<$num_row;$i++){
$a=mysql_fetch_array($dbqueryq);
echo "<tr>";
?>
<tr>
<td><span class="style2"><font size="2">
<input type="hidden" name="data[<?php echo$n;?>][studentid]" value="" />
<input type="hidden" name="data[<?php echo$n;?>][classroomid]" value="" />
<input type="hidden" name="data[<?php echo$n;?>][roomid]" value="" />
<input type="hidden" name="data[<?php echo$n;?>][education_part]" value="" />
<input type="hidden" name="data[<?php echo$n;?>][academic_year]" value="" />
<input type="hidden" name="data[<?php echo$n;?>][subjectid]" value="" />
<? echo $a[subjectid]; ?></font></span></td>
<td align="left"><span class="style2"><font size="2">
<input type="hidden" name="data[<?php echo$n;?>][subjectname]" value="" />
<? echo $a[subjectname]; ?></font></span></td>
<td>
<input type="text" name="data[<?php echo$n;?>][scall]" size="5" maxlength="2" value="" />
</td>
</tr>
<? } ?>
<tr>
<td colspan="3"> </td>
</tr>
<tr><?php endforeach; ?>
<td colspan="3"><div align="center"><span class="style2">
<input type="submit" name="Submit" value=" บันทึก ">
</span></div></td>
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2009-08-23 13:34:47 |
By :
doramelovely |
View :
1083 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่มีใครช่วยเลยหรอค่ะ 
|
 |
 |
 |
 |
Date :
2009-08-23 14:44:07 |
By :
doramelovely |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
(array(1)
$num_row;
$dbqueryq
พวกนี้มาจากไหนครับ
echo$n; > echo $n;
|
 |
 |
 |
 |
Date :
2009-08-23 16:42:30 |
By :
lozomac |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" name="form1" id="form1">
ลองเปลี่ยนเป็น
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="text/plain" name="form1" id="form1">
|
 |
 |
 |
 |
Date :
2009-08-27 19:34:20 |
By :
extenser |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อีกที่ครับ
if (isset($_POST['test']))
<input type="submit" name="Submit" value=" บันทึก ">
เปลี่ยน Submit เป็น name="test" ดูครับ
*ปล.ขอโทษที่ต้องโพสเบิ้ล 2 กระทู้ติดครับ พึ่ง code หาเจอ
|
 |
 |
 |
 |
Date :
2009-08-27 19:38:01 |
By :
extenser |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|