Reputation: 2148
$record_values = new Criteria();
$record_values->add(TblfieldsPeer::CUSTOMER_ID, $company_qu_id);
$record_values->add(TblfieldsPeer::RECORD_TYPE_ID, $query_rtype);
for($fieldid_arrayCount=0;$fieldid_arrayCount<count($fieldIds);$fieldid_arrayCount++)
{
$currentFieldId = $fieldIds[$fieldid_arrayCount];
if(isset($query_values[$fieldid_arrayCount]))
{
$criterion1 = $record_values->getNewCriterion(TblfieldsPeer::FIELDS_ID, $currentFieldId);
$criterion1->addAnd($record_values->getNewCriterion(TblfieldsPeer::FIELD_VALUES, $query_values[$fieldid_arrayCount]));
$record_values->add($criterion1);
}
}
$record_values_results = TblfieldsPeer::doSelect($record_values, $con1);
But only last criterion is added. I check the databases in debug toolbar only the last criterion is there. What could be the problem. Please help me....
Upvotes: 0
Views: 316
Reputation: 1279
I'm not a propel expert but maybe you could try to use 2 alternative changes:
addAnd
statement instead of add
one in $record_values->add($criterion1)
$record_values->add($criterion1)
outside the (of course after) cycle changing $criterion1
in a field outer the cycle and using only the addAnd
statement for $criterion1
Upvotes: 1