Used preg_split() instead of explode() to split sql query,
Since explode is case sensitive and if table or column contains substring "where" it will give an error