Bozzo Posted April 3, 2016 Share Posted April 3, 2016 (edited) 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 April 3, 2016 by Bozzo Quote Link to comment https://forums.phpfreaks.com/topic/301144-order-list-by-id-and-ascending-trouble/ Share on other sites More sharing options...
Jacques1 Posted April 3, 2016 Share Posted April 3, 2016 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. Quote Link to comment https://forums.phpfreaks.com/topic/301144-order-list-by-id-and-ascending-trouble/#findComment-1532760 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.