Fix php and sql errors for network inventory