我的网页版数据库删除功能是根据id来删除一整条,但是现在id只能是一个数字,不能是一个字符串,否则就不能成功删除,希望各位可以给一些修改意见。
```python
@app.route ('/del')
def de():
ida = request.args.get ('id')
res = func(f'DELETE stu,contract from stu LEFT JOIN contract ON stu.id=contract.contract_id where stu.id={ida}', m='w')
print(res)
if res:
return '<script>alert("删除成功");location.href="/sqldatejump/";</script>'
else:
return '<script>alert("删除失败");location.href="/sqldatejump/";</script>'
{% for i in userlist %}
<tr style="text-align:center">
<td>{{ i.id }}</td>
<td>{{ i.owner }}</td>
<td>{{ i.user }}</td>
<td>{{ i.ProjectName }}</td>
<td>{{ i.amount }}</td>
<td>{{ i.PictureNo }}</td>
<td>{{ i.content }}</td>
<td>{{ i.material }}</td>
<td><a href="/del?id={{ i.id }}">删除</a> |
<a href="/cha?id={{ i.id }}">更改</a>
</td>
</tr>
{% endfor %}