[eluser]Perkin5[/eluser]
I have a database table with product information - one column is called
price but instead of a number it has a letter, so it's actually a price category.
I have another database table with a column for price category (cat) and a column for value (val), so it ties down what each price cat means in numerical terms eg price cat A is $3.00.
So in the controller I fetch the product information in an array and I fetch the price cat information in another array and they are both passed to the view as
$records and
$price respectively.
What I now want to do is display the product information in a foreach loop, but instead of a price category, I want to replace it with the actual price. Although the necessary information is available, I've been unable to find a solution that works.
I thought something like:
Code:
foreach ($records as $item):
foreach ($price as $code){
if($code->cat == $item->price){$actual_price = $code->val;}
...more code
endforeach;
would do but CI throws an error.
I have an uneasy feeling I'm setting about this the wrong way. Can anyone suggest how it might be done?