嗨我有senario,我需要更新MySQL表中有学生ID和学生标记。现在学生证在这里是独一无二的。我如何只使用一种表格来更新所有的学生分数。如何更新表格输入学生的标记foreach学生标识每个标记在php mysql
$result= mysql_query("SELECT fname,usn FROM student where branch='$branch' and section='$section' and semester='$semester'") or die(mysql_error());
echo "<form action=\"marks.php\" method=\"POST\">";
echo "<table border='6' width='500' cellspacing='10' cellpadding='10' style='font-size:14px'>";
echo "<caption>";
echo "<b style='font-size:18px'>Internal</b> ";
echo "<b style='font-size:18px'>";
echo $internal;
echo "</b>";
echo " <b style='font-size:18px'>marks of</b> ";
echo "<b style='font-size:18px'>";
echo $subject;
echo "</b>";
echo "</caption>";
echo "<tr><th>USN</th><th>FNAME</th><th>MARKS</th></tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array($result)) {
echo "<tr><td>";
echo $row['usn'];
echo "</td><td>";
echo $row['fname'];
echo "</td><td>";
echo "<input name=\"internal\" type=\"text\" value=\"\" >";
echo "</td></tr>";
echo "</table>";
echo "<input name=\"update\" id=\"update\"type=\"submit\" value=\"submit \"align=\"middle\" >";
这伤害了我的眼睛。将所有逃脱的双引号改为未转义的单引号。这看起来像一团糟。 'echo'
如果我理解得当,比在所有行前面创建一个复选框并将它们的值设置为student id,然后更新所有选中的行.. – 2012-02-26 18:33:25
谢谢@Michael,我会这样做,一旦逻辑被破解.. – azzaxp 2012-02-26 18:51:37