我的查询是:
$select_userid_query = execute_pdo_query("SELECT user_id FROM users WHERE username='" . $_COOKIE['username'] . "'");
if ($select_userid_query == 0){
execute_pdo_query("INSERT INTO user_status
(user_id,last_activity_time) VALUES
((SELECT user_id FROM users WHERE username='" . $_COOKIE['username'] . "'),NOW())"
, array($user_id, $last_activity_time));
}
else{
execute_pdo_query("UPDATE user_status SET user_id = (SELECT user_id FROM users WHERE username='" . $_COOKIE['username'] . "'),last_activity_time= NOW()", array($user_id, $last_activity_time));
}
我想验证数据库中是否有记录,如果没有插入,是否只是用新的更新时间NOW()
任何想法我的语法错误在哪里?