My Table structure
CREATE TABLE IF NOT EXISTS `login` (
`eMail` varchar(50) NOT NULL,
`Password` tinytext NOT NULL,
`UID` int(9) unsigned NOT NULL AUTO_INCREMENT,
`Name` varchar(16) NOT NULL,
`Text` tinytext NOT NULL,
`OldText` tinytext NOT NULL,
`LastSeen` timestamp NULL DEFAULT NULL,
`SecurityQuestion` tinytext NOT NULL,
`SecurityAnswer` tinytext NOT NULL,
PRIMARY KEY (`UID`),
UNIQUE KEY `eMail` (`eMail`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
When ever i try to update the LastSeen
it shows as slow query [get logged into the slow query log file]
A Sample SQL code [PHP]
$time = date("Y-m-d H:i:s");
UPDATE LO开发者_如何学JAVAGIN set LastSeen=? WHERE UID=?
mysqli_stmt_bind_param($stmt,"si",$time,$uid);
Edit:
LastSeen
filed is not automatically updated].You shouldn't be updating a timestamp
column: timestamp columns are automatically updated to the current time whenever you update the row.
If you want an updatable "timestamp" column in mysql, use the datetime
datatype.
精彩评论