adding key-> value pair to an array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,
Can anybody tell me how can I add key->value pair in an array.
My code is as follows

 $criteria = array();
 $criteria['mail_subject'] = $form->subject->getValue();
 $criteria['delivery_user_name'] = $form->delivery_user_name->getValue();
 $criteria['start_date'] = $form->start_date->getValue();
 $criteria['end_date'] = $form->end_date->getValue();
 $criteria['group'] = $form->group->getValue();
		
 // get table data from database
 $rowset = $mailDelivery->findDeliveryMailData($criteria);

//convert rowset into an array
 $mailDataArray = $rowset->toArray();
	 		

 if(count($mailDataArray) != 0){
	foreach($mailDataArray as $row){					
		$condition['mail_delivery_id'] = $row->id;
		$browseCount = $mailDeliveryDetail->findBrowseCount($condition);
		$totalCount = $mailDeliveryDetail->findTotalCount($condition);
              //for each row I want to add percentage as new key->value pair
                         // but it gives error 'Undefined variable:
percentage'
		$row->$percentage = ($browseCount / $totalCount ) * 100; 		
 }
 }


Please somebody tell me how to achieve this.
Thanks in advance.
Aniket
-- 
View this message in context: http://www.nabble.com/adding-key-%3E-value-pair-to-an-array-tp20809114p20809114.html
Sent from the PHP - General mailing list archive at Nabble.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux