沒寫過MySql,大概這樣吧
function update_record(username)
$username1 = select top 1 username from table1 order by update_time
if $username1 = $username
then
update table1 set ...
else
insert into table1 values(...)
function update_record(username)
$username1 = select top 1 username from table1 order by update_time
if $username1 = $username
then
update table1 set ...
else
insert into table1 values(...)