title: MySQL cursor returns only one record
body: <p>I'm using Hostgator to host my PHP Website with MySQL 5.5.33 and PHPMyAdmin 3.5.5. I want to use cursor to get values from individual record in a table. The followings is the code for that stored procedure:</p>
  
  <pre><code>CREATE DEFINER=`lnutri`@`localhost` PROCEDURE `TestCursor`()
     NO SQL
  BEGIN
  DECLARE done INT DEFAULT FALSE;
  DECLARE cGroupID INT;
  DECLARE cGroupName VARCHAR(50);
  DECLARE cursor1 CURSOR FOR SELECT GroupID, GroupName FROM Groups;
  DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
  
  OPEN cursor1;
  
  read_loop: LOOP
  FETCH cursor1 INTO cGroupID,cGroupName;
  IF done THEN
      LEAVE read_loop;
  END IF;
  SELECT cGroupID AS GroupID, cGroupName as GroupName;
  
  END LOOP;
  
  CLOSE cursor1;
  END
  </code></pre>
  
  <p>But the stored procedure seems to return the first record only:</p>
  
  <pre><code>GroupID GroupName
  1           Default Group
  </code></pre>
  
  <p>This is the structure of the Groups table</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `Groups` (
    `GroupID` int(11) NOT NULL AUTO_INCREMENT,
    `GroupName` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
    `Description` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
    `DateCreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`GroupID`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=39 ;
  </code></pre>
  
  <p>And this is the Groups Table's data:</p>
  
  <pre><code>GroupID GroupName   Description DateCreated
  1           Default Group               0000-00-00 00:00:00
  2           Group 2                     0000-00-00 00:00:00
  29          Regis                       0000-00-00 00:00:00
  31          Benetas                     0000-00-00 00:00:00
  32          Domain                      0000-00-00 00:00:00
  36          none                        0000-00-00 00:00:00
  37          Aevum                       2013-11-11 17:40:56
  38          Uniting Aged Care       2013-11-15 07:26:19
  </code></pre>