"No valid database connection" problem occurring when i am using following Query

 `SET SESSION SQL_BIG_SELECTS=1`

Any idea, based on how to solve it...?? NOTE:: This question execute by PHP script