some more changes to php and the sql script