An extraordinarily bad use of php and mysql