开发者

PHP+MySQL Update TimeStamp and get NOW() back

Is it possible to merge these two mysql queries into one? I want to get NOW() returned to a php variable.

mysql_query('INSERT INTO translate (IDRef, RefType, Lang, Text, LastChangeTS) VALUES ('.$id.', \''.$reftype.'\', \''.$lang.'\', \''.$text.'\', NOW()) ON DUPLICATE KEY UPDATE text = \''.$text.'\', LastChangeTS = NOW()');

mysql_query('SE开发者_开发问答LECT LastChangeTS FROM translate WHERE IDRef = '.$id.' AND RefType = \''.$reftype.'\' AND Lang = \''.$lang.'\'');


You can't merge a insert statement and a select statement. But, you can sure use a stored procedure which inserts the data and then returns the LastChange value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜