in reply to Re: I wrote a very ugly piece of code, can someone help me correct it?
in thread I wrote a very ugly piece of code, can someone help me correct it?

Alternatively, if $title isn't being used elsewhere, since a single row is being returned something like:

Update data set lock=1 where id=( select id from data where id is not null and .... <rest of the where clause here> .... )