Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Dinamycally generate an array data
Old 09-28-2010, 04:57 AM Dinamycally generate an array data
Junior Talker

Posts: 1
Name: Ovidiu
Trades: 0
Hi all,

I have a table containing about 10 records and each record has a unique ID. I'm trying to dynamically generate a pie chart according to each record

The output I want is this:

Code:
$pct_data = array(
            new pie_value($this->Client->count_all_by_pct(1,$thisMonth), $this->Pct->info(1)->name.', '.$this->Pct->info(1)->location.' ('.$this->Client->count_all_by_pct(1,$thisMonth).')'),
            new pie_value($this->Client->count_all_by_pct(4,$thisMonth), $this->Pct->info(4)->name.', '.$this->Pct->info(4)->location.' ('.$this->Client->count_all_by_pct(4,$thisMonth).')'),
            new pie_value($this->Client->count_all_by_pct(6,$thisMonth), $this->Pct->info(6)->name.', '.$this->Pct->info(6)->location.' ('.$this->Client->count_all_by_pct(6,$thisMonth).')'),
            new pie_value($this->Client->count_all_by_pct(54,$thisMonth), $this->Pct->info(54)->name.', '.$this->Pct->info(54)->location.' ('.$this->Client->count_all_by_pct(54,$thisMonth).')'),
            new pie_value($this->Client->count_all_by_pct(71,$thisMonth), $this->Pct->info(71)->name.', '.$this->Pct->info(71)->location.' ('.$this->Client->count_all_by_pct(71,$thisMonth).')'),
            new pie_value($this->Client->count_all_by_pct(110,$thisMonth), $this->Pct->info(110)->name.', '.$this->Pct->info(110)->location.' ('.$this->Client->count_all_by_pct(110,$thisMonth).')')
        );  
        $pie->set_values($pct_data);
The code I have right now is this, but it doesn't seem to work...

Code:
foreach($this->Pct->get_them()->result_array() as $row)
           {
            $pct_id = $row['pct_id'];
            foreach ($pct_id as $id)
            {
                $pct_data = new pie_value($this->Client->count_all_by_pct($id,$thisYear), $this->Pct->info($id)->name.', '.$this->Pct->info($id)-location.' ('.$this->Client->count_all_by_pct($id,$thisYear).')');
            }
        }
        
        $pie->set_values($pct_data);
Thanks!
cicovy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Dinamycally generate an array data
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09710 seconds with 12 queries