Home > Backend Development > PHP Tutorial > 求解:数据插入不到数据库中。解决方案

求解:数据插入不到数据库中。解决方案

WBOY
Release: 2016-06-13 13:37:59
Original
1314 people have browsed it

求解:数据插入不到数据库中。
数据库确定已经连接成功了。表名keai_user 字段f_logintimes(登录次数) f_lasttime(最近登录时间) f_loginip(登录IP地址)
$ip = $_SERVER['REMOTE_ADDR'];
$sql = "UPDATE keai_user SET f_logintimes = f_logintimes + 1,";
$sql .= "f_lasttime = now(),f_loginip = '$ip'";
$sql = "WHERE f_username = '$username'";
$db->query($sql);执行后表keai_user 内容没有任何变化,不知道为什么?

------解决方案--------------------

引用$db->query($sql);执行后表keai_user 内容没有任何变化,不知道为什么?

------解决方案--------------------
$sql = "WHERE f_username = '$username'"; 
 
写错了吧!
$sql .= "WHERE f_username = '$username'";
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template