samedi 18 juin 2016

Order ASC for numbers after alphabets

I have a list of products displaying in ASC(Ascending) order in SQL like Order BY Name ASC But following attached image doesn't really work for numbers.

Below are the results as ORDER BY Name ASC but i wanted results as shown in image with arrangement numbers in red.

My Current SQL is : SELECT * FROM Products Order BY Name ASC

Results are on DataTables so not sure if order is set by sql or DataTables ASC Order for Name.

Jquery of Datatables:

<script>
    $(document).ready(function() {
    $('#table-<?php echo $row_Categories['ID'];?>').DataTable( {
         paging: false,
                    "bInfo" : false,


    }
     );
} );
</script>   

enter image description here enter image description here

<thead>
  <tr>
    <th>Brand</th>
    <th>Composition</th>
    <th class="hidden-sm hidden-xs">Packing</th>
    <th>Type</th>
    <th class="hidden-sm hidden-xs">Image</th>
  </tr>
  </thead>
    <tbody>      
<!-- repeats -->
<tr>
    <td><?php echo $row_Products['Name'];?></td>
    <td><?php echo $row_Products['Composition'];?></td>
    <td><?php echo $row_Products['Packing'];?></td>

    <td><?php echo $row_Products['PackType'];?></td>
   <td>

    <img src="images/products/thumbs/<?php echo $row_Products['MainImageThumb'];?>" style="height:90px">

    </td>

  </tr>

<!-- repeats -- >
</tbody>

Aucun commentaire:

Enregistrer un commentaire