in reply to SQL Session ID troubles (was: an easy one)

Hurm, it would help if we could see what the query was. Is the sessionid a varchar that's getting alphabetized in a way you didn't expect?

BTW, you probably want to say

($sessionid) = $logquery->fetchrow_array()
to make sure that list-to-scalar conversion doesn't bite you.