calling stored procedure from MySQL in Cakephp gets only first row of result
===

As I call my SP, it only gives me the first result, and on the second call, it gives me this:

    Error: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.

Well, I have checked the related questions as suggested by Stackoverflow. Some gave me the idea but when I tried it, it does not work. 

Here's the loop inside my function that calls my SP:

    foreach ($filenames as $value)
    	{
    	$queryssid = "CALL GetUniqueSSIDByCategoryCombine('$username','$value');";
    	$dataUniqueSSID = $this->User->query($queryssid);
    	pr($dataUniqueSSID);
    	}

here's my SP:

    CREATE DEFINER=`root`@`localhost` PROCEDURE `GetUniqueSSIDByCategoryCombine`(uid VARCHAR(50),filename VARCHAR(50))
     BEGIN
     SELECT  DISTINCT(transaction_details.essid) AS 'SSID', transaction_details.protocol AS 'protocol', TRANSACTION.filename
     FROM    transaction_details transaction_details, TRANSACTION TRANSACTION  
     WHERE transaction_details.uid_filename_link = TRANSACTION.uid_filename_link AND transaction_details.uid_filename_link = 
         (
             SELECT distinct(transaction.uid_filename_link) FROM TRANSACTION 
             WHERE transaction.uid = uid AND transaction.filename = filename
         ) 
     ORDER BY row_id;
         END


What could possibly be the solution. It's my second day dealing with this error and it's kinda frustrating. Thanks in advance.



