百度登录插入数据库
21-05-28 21:36
2538
1
赞
踩
已编辑
$user_num = $con->query(" SELECT * FROM `user` WHERE `baidu_id` = '$baidu_id'")->num_rows;
if ($user_num > 0){
$con->query("INSERT INTO `user` (`id`, `baidu_id`, `name`, `baidu_pic`, `baidu_key`) VALUES (NULL, '{$_SESSION['baidu_uid']}', '{$_SESSION['nickname']}', '{$_SESSION['smallpic']}', '{$_SESSION['accesstoken']}')");
}else{
$con->query("UPDATE `user` SET `name` = '".$_SESSION['nickname']."', `baidu_key` = '".$_SESSION['accesstoken']."', `baidu_pic` = '".$_SESSION['smallpic']."' WHERE `baidu_id` = '$baidu_id'");
}
0 人点赞
请登录后发表评论
把IF改成<= 就好了吧