last_insert_id()
applies to INSERT queries only. The last insert performed by a particular connection. It will not report on inserts done in other connections, it will not report on inserts you did with your account 10 days ago.
You're not doing an insert, just a SELECT
.
You need to use SELECT MAX(id)
instead... and note that this is highly racy. If you're using it to generate client-side IDs, don't. Another parallel client can swoop in behind your back and steal away the ID you're generating, or create an even newer/bigger ID.