有没有一种方法可以更改表中的值?

我的老师给了我作业,我不知道该怎么做。我的任务是连接到数据库服务器,获取我有权访问的所有表,然后显示它们。我必须能够添加SQL命令来创建,删除,更新或插入数据或其他表,而我已经完成了所有这些操作,但是他还想要一件事。他希望我这样做,如果我单击表中的特定单元格,则可以更改其中的数据,该数据将发送回我的flask应用程序,以便可以从中创建Update sql命令。

我想用mysql创建javascript,但是javascript不支持它,我也不知道下一步该怎么做

这是我的html页面:

<body>
<h2>Error : {{error}}</h2>
    <table id="customers">
    {% for row in data %}
        {% if row[2]|length %}
        <tr>
            <td ><h2>{{row[0]}}</h2></td>
        </tr>
        <tr>
            {% for col in row[1] %}
            <th scope="col">{{col}}</th>
            {% endfor %}
        </tr>
        {% for x in row[2]%}
        <tr>
            {% for j in x %}
            <td>
                {{j}}
            </td>
            {% endfor %}
        </tr>
        {% endfor %}
        {% endif %}
    {% endfor %}
</table>

    <form action="" method="post">
  Enter your sql command:<br>
  <input type="text" name="sql_command">
  <br>
  <input type="submit" value="Submit">
</form>
</body>

这是我的python应用程序,可在其中获取所有数据:

for (table_name,) in tables:
    cursor.execute("""select * from """ + table_name)
    table_data = cursor.fetchall()
    columns = cursor.column_names
    for x in range(count):
        if data_full[x][0] == table_name:
           data_full[x][1] = columns
           data_full[x][2] = table_data
zx705 回答:有没有一种方法可以更改表中的值?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3125706.html

大家都在问