> babu nair wrote:
>> Please can any one for auto generated table,tr,td according to the query
>> result.
>> for ex:
>>    columns:7
>>    query size:3
>> 
>>             it should generate 7 <td> and 3 <tr>
> 
HI Babu,

May be thiese lines helpful for u.

CODE:

class Table

  def open_table
    print "<table>"
  end

  def close_table
    print "</table>\n"
  end

  def open_tr
    print "<tr>"
  end

  def close_tr
    print "</tr>"
  end

  def open_td
    print "<td>"
  end

  def close_td
    print "</td>"
  end



  def create_row(number)
    open_table
    number.times do
    open_tr
    close_tr
    end
    close_table
  end


  def create_column(number)
    open_table
    number.times do
    open_td
    close_td
    end
    close_table
  end



end

t=Table.new
print t.create_row(2)
print t.create_column(2)


Regards,
P.Raveendran
http://raveendran.wordpress.com

-- 
Posted via http://www.ruby-forum.com/.