我的HTML表格是根据每个用户表格的大小生成的。如何更新我的SQL表,以便我可以在HTML表生成时添加许多输入?
$ num生成用户需要填写的文本框数。我想用我输入的所有数据更新我的sql表。
$num = 0;
while($row = mysqli_fetch_array($result))
{
$num = $num+1;
echo "<tr>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['producto'] . "</td>";
echo "<td>" . '<input type = "text" name = "cantidad' . $num . '" value = "" size = "40" />' . "</td>";
echo "<td>" . '<input type = "text" name = "precio' . $num . '" value = "" size = "40" />' . "</td>";
echo "</tr>";
}
echo "</table>";
答案 0 :(得分:1)
声明@SQL Nvarchar(Max) IF(checkYourCondition) 开始 SET @ SQL =''+ @ username +''+ @ producto +'' 结束 设置@SQL = @SQL +'' 执行sp_executesql @SQL