added php for dynamic queries