Convert the code from PHP to Ruby

Posted by theband on Stack Overflow See other posts from Stack Overflow or by theband
Published on 2010-05-01T20:58:53Z Indexed on 2010/05/02 1:17 UTC
Read the original article Hit count: 285

Filed under:
|
public function getFtime() {

       $records=array();
        $sql="SELECT * FROM `finishedtime`";
        $result=mysql_query($sql);   
        if(!$result){throw new Exception(mysql_error());}
        if(mysql_num_rows($result)==0){return $records;}
        while($row=mysql_fetch_assoc($result)){$records[]=$row;}
        return $records;

   }

I am in the process of learning Ruby, can anyone convert this code into Ruby. This will make me construe on how to run a query and thrown the fetched result back.

© Stack Overflow or respective owner

Related posts about php

Related posts about ruby