PHP+MySQL Update TimeStamp and get NOW() back
Posted
by
Ben
on Stack Overflow
See other posts from Stack Overflow
or by Ben
Published on 2010-12-27T15:50:56Z
Indexed on
2010/12/27
15:53 UTC
Read the original article
Hit count: 148
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('SELECT LastChangeTS FROM translate WHERE IDRef = '.$id.' AND RefType = \''.$reftype.'\' AND Lang = \''.$lang.'\'');
© Stack Overflow or respective owner