gpt4 book ai didi

php - php 查询错误

转载 作者:行者123 更新时间:2023-11-29 09:12:23 25 4
gpt4 key购买 nike

它说我的语法有错误,我似乎找不到错误。

$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' ";

或者这个:

$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}";

关于php - php 查询错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5209541/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com