Time to learn more rails and ruby my friend. We're not going to write  
your code for you. Have an attempt and then ask questions about that  
in a succinct and clear manner.

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

On 05/02/2009, at 2:09 PM, Shankar Ganesh <[email protected] 
 > wrote:

>
> hi,
>   Shown below is the PHP code to obtain the value for each date in the
> corresponding date range.And with I've attached the MYSQL Database
> Table.Please Have a look.I've tried to convert this code to rails but
> not yet succeeded.Please let me know if you can do....
>
> <?php
> $con=mysql_connect("localhost","root","");
> mysql_select_db("dgrid_development",$con);
> $sql=mysql_query("select * from events");
>
> while($row=mysql_fetch_array($sql))
> {
>  $date_array = date_range($row["when"],$row["to"]);
>  $txt='('.$row["what"].'-'.$row["color"].')';
>  $arrayMixed[]= array_fill_keys($date_array, $txt);
> }
>
> function date_range($sd,$ed)
> {
>  $tmp = array();
>  $sdu = strtotime($sd);
>  $edu = strtotime($ed);
>  while ($sdu <= $edu)
>  {
>   $tmp[] = date('Y-m-d',$sdu);
>   $sdu = strtotime('+1 day',$sdu);
>  }
> return ($tmp);
> }
>
> foreach($arrayMixed as $final)
> {
> foreach($final as $key=>$value)
> {
>   $group[$key].=$value;
> }
> }
>
> print'<pre>';
> print_r($group);
> print '</pre>';
> ?>
>
> Thanks in Advance.
>
> cheers,
> Shankar.
>
> Attachments:
> http://www.ruby-forum.com/attachment/3262/events.sql
>
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to