[Skunkworks] PHP/MySQL logic problem