Please am having a little challenge. What i want to do is simple but i cant get it done.
I have a multiple select box the post array of values to my controller.
lets say:
$data = array(1,2,3,4,5)
in my controller, what i would like to do is to run yii createCommand where coloumn_name = $data. but my function actionSendRfp($id) returns one record. instead of 5 records.
Can anybody help me?
public function actionSendRfp($id)
{
$data = $this->loadModel($id);
$model = new Rfpmessagelog;
$v = new Vendors;
if(isset($_POST['Rfpmessagelog']))
{
$model->attributes = $_POST['Rfpmessagelog'];
$model->vendors_name = $_POST['vendors_name_selected'];
$model->validate();
$split = explode(",",$model->vendors_name); // this is an array of data ("1,2,3,4,5")
foreach($split as $key=>$vendors)
{
$result = Yii::app()->db->createCommand()
->select('*')->from('tbl_vendors')
->where('company_name=:company_name', array(':company_name'=>$vendors))
->queryRow();
//$findVendors = Vendors::model()->find('company_name =:company_name',array(':company_name'=>$vendors));
echo $result['email']."</br>";
}
Oh sorry, no error, but if i echo $required_data[$key], it returns only one email address. what i want to do is to send email to all the email addresses after retrieving them
Please can anybody help me? I’m stucked right now if i echo var_dump($required_data); this is the array returned. The query can only find the first record