So I'm always getting the this error-message: MySQL-Error: Unknown column 'dompol171' in 'where clause'.
So it is comparing the username that I entered with the column "user_name" itself. I keep freaking out...since I have no clue how to compare it in a different way!
解决方案
Try Using This:
$username = $_POST['username'];
$query = "SELECT user_name FROM users WHERE user_name='" . $username . "'";
这篇博客讨论了一个PHP代码中的MySQL查询错误,该错误导致了'Unknown column'错误。作者尝试从users表中查找匹配的user_name,但错误地将POST变量直接插入了WHERE子句。解决方案是正确地将POST变量与user_name列进行比较,修正后的查询避免了直接使用用户输入作为列名。
566

被折叠的 条评论
为什么被折叠?



