hey guys… can anyone tell me how do I compare the data in database table and seleceted item in dropdown.I mean when I select the item in my dropdown how do I find the that seleceted item alredy in the database??
help me pls…
thanx in advance…
hey guys… can anyone tell me how do I compare the data in database table and seleceted item in dropdown.I mean when I select the item in my dropdown how do I find the that seleceted item alredy in the database??
help me pls…
thanx in advance…
$result = findByAttributes(array('item_db'=>$item));
if(count($result)>0)
{
// Items are in db
}
else{
///not in db
}
does not make sense why do you wanna check if item exists in database, what I mean if you displaying item/items in your select/dropdown obviously it exists since it come from database in the first place.
yes you are right.bt I need to check was that selected item in the database.if it in the database I need to provide some message.it depend on current logged user .that’s why I asked.can you help me ?how to do that?
there are item in dropdown from speciality table.i need to when user selected item in dropdown if it is seleceted in earlier.it mean if it is alredy in the database.if itg is alredy in the database i need to provide message.pls helpme.how to do that.
try this
$vsen_liqoer = LiquorCategory::model()->findAll("category_name='" . $_REQUEST['VenueLiquor']['new_category_name'] . "' ");
if (count($vsen_liqoer) > 0) {
Yii::app()->user->setFlash('error', Yii::t("messages","There is already assignde to dropdown pleaser try again!"));
$this->redner('your page');
Yii::app()->end();
}else{
//insert the dropdown value
}