它说我的语法有错误,我似乎无法找到错误。
$query_admin = 'SELECT * FROM `user_accounts` WHERE `id` =1 AND `name` LIKE ' . $login_user_name . ' AND `password` LIKE ' . $login_password . ';
$query_user = 'SELECT * FROM `user_accounts` WHERE `name` LIKE ' . $login_user_name . ' AND `password` LIKE ' . $login_password . ';
答案 0 :(得分:1)
phpMyAdmin与此有什么关系?
你不应该以{{1}}结束你的行。这就是给你语法错误的原因。
只需删除它们就可以了。
答案 1 :(得分:1)
尝试这个我认为你忘了把'放在查询字符串的末尾:
$query_admin = "SELECT * FROM `user_accounts` WHERE `id` =1 AND `name` LIKE '$login_user_name' AND `password` LIKE ' $login_password'";
$query_user = "SELECT * FROM `user_accounts` WHERE `name` LIKE '$login_user_name ' AND `password` LIKE '$login_password' ";
或者这个:
$query_admin = "SELECT * FROM `user_accounts` WHERE `id` =1 AND `name` LIKE {$login_user_name} AND `password` LIKE {$login_password}";
$query_user = "SELECT * FROM `user_accounts` WHERE `name` LIKE {$login_user_name} AND `password` LIKE {$login_password}";
答案 2 :(得分:0)
我没有测试它。似乎是你最后有一个'到很多人。
'SELECT * FROM `user_accounts` WHERE `id` =1 AND `name` LIKE ' . $login_user_name . ' AND `password` LIKE ' . $login_password ;