Jump to content

Recommended Posts

Hi all, I'm trying to order a list by Id and ascending and i dont figure out how, everything i try is not working! please help this is the link with ejemplo:

 

Producto 3 was last inserted and it showing appear first... and should appear last...

 

http://rumnorte.es/office/estimate/8cea8fec621d501c0f3e560fabe120ead56d4755

 

 

Here is the code:

<?php
foreach (DB::table('options')->get() as $o) { $data[$o->option_name] = "".$o->option_value.""; }
?>
 
                    <tbody>
                        <?php $total=0; $index = 1; $totalfinal = 0; ?>
                        @foreach ($products as $pro)
                        <tr>
                            <td>{{$index}}</td>
                            <td>
                                <dl>
                                    <dt>{{ $pro->product_name }}</dt>
                                    <dd>{{ $pro->product_description }}</dd>
                                </dl>
                            </td>
                            <td class="text-right">{{ $pro->unit }}</td>
                            <td class="text-right"><?php echo $data['currencysymbol']; ?> <?php echo number_format($pro->cost, 2, '.', ','); ?></td>
                            <td class="text-right"><?php echo $data['currencysymbol']; ?> <?php echo number_format($pro->unit*$pro->cost, 2, '.', ','); ?></td>
                        </tr>
                        <?php $total += $pro->unit*$pro->cost; $index++; ?>
                        @endforeach
                    </tbody>  
 
 
 
 
Any advice really welcome!
Edited by Bozzo
Link to comment
https://forums.phpfreaks.com/topic/301144-order-list-by-id-and-ascending-trouble/
Share on other sites

The “Questions, Comments, & Suggestions” forum is for comments about this site, not PHP questions. Moving to PHP Coding Help.

 

Your code doesn't tell us anything about the query which yielded the $products array. You need to show the database-related code, not the HTML stuff.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.