This error message appears in MySQL, when the functions are called in the wrong order.
You must debug your code and find which functions may cause problem in the order. Generally "mysql_use_result()" and "mysql_free_result()" functions are related with thees kind of problems.