简体   繁体   English

SQL单元格中的SQL查询

[英]SQL-Query in SQL Cell

I'm building a Website. 我正在建立一个网站。 Some MYSQL-Queries take place in there. 一些MYSQL-Queries发生在那里。

If someone updates an field, i want to create a simple "log-system" 如果有人更新字段,我想创建一个简单的“日志系统”

like 喜欢

$SQL="UPDATE table_name SET column1=text WHERE id = nr"
msyqli_query($link,$SQL)

would be the regular update of a table 将是表的定期更新

for the log i want to do: 对于我想做的日志:

msyqli_query($link, "INSERT INTO table_name2 (column_user, column_query) VALUES ($user, $SQL)")

I heard in some cases the Table will execute the query again, if a query is saved to a field. 我听说在某些情况下,如果查询保存到字段,表将再次执行查询。

What could happen in my case? 在我的情况下会发生什么?

您需要在将查询插入table_name2之前转义该查询。

$SQL = mysqli_real_escape_string($link, $SQL);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM