Welcome Guest, Not a member yet? Register   Sign In
post multiple different ratings
#1

[eluser]tim peterson[/eluser]
hi all,

I'm having a heck of a time figuring out how to post multiple ratings for different items,


this code let's me rate multiple items, but not single items:

<b> for($i=0;$i<2; $i++)
{
$doc_item_id=$_POST['item_id0'][$i];
$doc_rating=$_POST['document_rating'][$i] ;

$it_rt = array(
'item_id'=> $doc_item_id,
'rating' => $doc_rating,
);
$this->purchases_model->update_document($it_rt);
}
</b>

whereas this code let's me rate only the first item:

<b> foreach($_POST['item_id0'] as $doc_item_id)
{
foreach($_POST['document_rating'] as $doc_rating)
{
}
break;
}
$it_rt = array(
'item_id'=> $doc_item_id,
'rating' => $doc_rating,
);
$this->purchases_model->update_document($it_rt);
</b>

any thoughts on how to correct either of these would be greatly appreciated,

thank you,
tim
#2

[eluser]adamfairholm[/eluser]
Can you give us an idea of what you are trying to accomplish outside of these functions?




Theme © iAndrew 2016 - Forum software by © MyBB