A "foreach" issue i'm having
<p>I'm having a hard time trying to figure this out, i am having a duplicate "$order_id" issue and i don't wan't the order to display if "$order_id" does not equal to the "$quantity" ordered.</p>

<p>So Let's say this is the order:</p>

<pre><code>ID - ORDER_ID - QUANTITY
1900 - 1200 - 1
1901 - 1200 - 1
1902 - 1200 - 1
1903 - 1200 - 1
</code></pre>

<p>This should just foreach 1 times.</p>

<p>But if it would look like this:</p>

<pre><code>ID - ORDER_ID - QUANTITY
1900 - 1200 - 4
1901 - 1200 - 4
1902 - 1200 - 4
1903 - 1200 - 4
</code></pre>

<p>This should be displayed... it might just be the mood i'm in, but i just can't seem to figure this out...</p>

<p>Thanks guys! ;)</p>

<p>---- REPLY -----</p>

<p>Hey,</p>

<p>Just updated my question, it's more of a "quantity" rather than "amount".</p>

<p>So for an example if i would echo this out, and the quantity is "1" but the order_id has a duplicate entry of "4" times that should just display "1" times, it should just display the same order_id, "quantity" xx times...</p>

<p>Not sure how i can explain further ?... don't mind the exact code, as it's just an example trying to make clear on what i'm after...</p>

<pre><code>&lt;?php 
foreach($coupon_details as $coupon_detail)
            {

            echo = '&lt;td&gt;';

        echo = 'order_id:' . $order_detail=get_single_row("orders",array("id"=&gt;$coupon_detail-&gt;order_id)) . ;

        echo = '&lt;/td&gt;&lt;td&gt;';

        echo = 'quanitity:' . $order_detail=get_single_row("orders",array("id"=&gt;$coupon_detail-&gt;quantity)) . ;

        echo = '&lt;/td&gt;&lt;td&gt;';

        }
    ?&gt;
</code></pre>

<p>This example would be the MySQL table data...</p>

<p>So Let's say this is the order:</p>

<pre><code>ID - ORDER_ID - QUANTITY
1900 - 1200 - 1
1901 - 1200 - 1
1902 - 1200 - 1
1903 - 1200 - 1
</code></pre>

<p>This should just foreach 1 times.</p>

<p>But if it would look like this:</p>

<pre><code>ID - ORDER_ID - QUANTITY
1900 - 1200 - 4
1901 - 1200 - 4
1902 - 1200 - 4
1903 - 1200 - 4
</code></pre>

<p>---- REPLY 2 -----</p>

<p>Was asked for an expected output in the view file. (NOT DATABASE)</p>

<p>This is in the DATABASE</p>

<pre><code>ID - ORDER_ID - QUANTITY
1900 - 1200 - 1
1901 - 1200 - 1
1902 - 1200 - 1
1903 - 1200 - 1
</code></pre>

<p>AND THIS IS HOW I WOULD LIKE IT TO ECHO FOREACH FROM DB</p>

<pre><code>ID - ORDER_ID - QUANTITY
1900 - 1200 - 1
</code></pre>
