我有两个表形成foriegn键约束tablename和Column_table。在表tablename中,我将仅存储用户输入的表名,并在另一个表column_table中存储其列名。 column_table的字段为h1到h40。 col_heading表的值将由用户使用dymanic文本框插入,该文本框将保存在列h1-h40中,其中tablename的id在column_table中匹配。怎么做?
following code is to display data and add dynamic textboxes.
$select = "SELECT * FROM column_table";
$result= mysqli_query($bd, $select);
<table align="center" class="table " cellpadding="10" id="user_table">
<tr>
<th>NAME</th>
</tr>
<?php
while ($row=mysqli_fetch_array($result, MYSQLI_ASSOC))
{
?>
<tr id="row<?php echo $row['id'];?>">
<td id="name_val<?php echo $row['id'];?>"><?php echo $row['name'];?></td>
<td>
<input type='button' class="edit_button btn-success btn" id="edit_button<?
php echo $row['id'];?>" value="edit" onclick="edit_row('<?php echo $row['id'];?>');">
<input type='button' class="save_button btn-success btn" id="save_button<?php echo $row['id'];?>" value="save" onclick="save_row('<?php echo $row['id'];?>');">
<input type='button' class="delete_button btn-success btn" id="delete_button<?php echo $row['id'];?>" value="delete" onclick="delete_row('<?php echo $row['id'];?>');">
</td>
</tr>
<?php
}
?>
<tr id="new_row">
<td><input type="text" class="form-control1" id="new_name"></td>
<td><input type="button" class="btn-success btn" value="Insert Row"
onclick="insert_row();" required></td>
</tr>
</table>
如何编写插入查询?