numeric data's not sorting

numeric data's not sorting

indian_arulindian_arul Posts: 1Questions: 0Answers: 0
edited February 2012 in General
Hi,
I'm trying sorting numeric values which is stored in database, but it's not properly sorting.. but manual values sorting properly...
it's sorting like as follow. do I need to add any plugin for this.

1.50
10.00
11.50
112.30
13.50
400.00
6.00
63.00
9.0

can you guys help me to resolve it.

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    If that data isn't sorting numerically then there must be something else somewhere that is causing it to not be picked up as a number. Can you link me to your page so I can take a look please?

    Allan
  • indian_arulindian_arul Posts: 1Questions: 0Answers: 0
    Thanks for your reply Allan
    Here you can find my source code get_amount_in_dollar, get_dollar_rate & grand_total there are I stored as decimal numbers in my database which is not sorting properly...


    <?php
    include("db_info.php");
    include("my_money_format.php");
    $result = mysql_query("SELECT * FROM money_withdraw ORDER BY id desc");
    $grand_total=0;
    ?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

    <!--

    Created using /
    Source can be edited via /ayewus/2/edit

    -->



    DataTables live example

    @import "media/css/demo_page.css";
    @import "media/css/demo_table.css";
    @import "media/css/ColReorder.css";
    @import "media/css/ex_highlight.css";
    @import "media/css/TableTools.css";










    $(document).ready(function() {
    $('#example').dataTable( {
    "aaSorting": [[ 0, "desc" ]],
    "bPaginate": true,
    "sPaginationType": "full_numbers",
    "aLengthMenu": [[5, 10,20, 25, 50, -1], [5,10,20,25, 50, "All"]]

    });
    });





    Money Withdraw Details


    Add New






    Date
    Mode
    Account
    Amount in $
    $ Value
    Status
    Total
    Edit
    Delete




    <?php while($row = mysql_fetch_array($result)) {
    $id= $row['id'];
    $get_withdraw_date= $row['withdraw_date'];
    $put_withdraw_date = date('Y/m/d', strtotime($get_withdraw_date));
    $get_amount_in_dollar = $row['amount_in_doller'];
    $get_dollar_rate = $row['doller_rate'];
    $total_amount = $get_amount_in_dollar * $get_dollar_rate;
    ?>

    <!-- <?php echo $row['id'];?> -->
    <?php echo "$put_withdraw_date";?>
    <?php echo $row['mode_of_payment'];?>
    <?php echo $row['account'];?>
    <?php echo "$ ".$get_amount_in_dollar;?>
    <?php echo "$get_dollar_rate";?>
    <?php echo $row['status'];?>
    <?php echo my_money_format($total_amount);?>

    Edit
    Delete


    <?php $grand_total= $grand_total + $total_amount;} ?>



    Total Amount Received
    <?php echo my_money_format($grand_total);?>
This discussion has been closed.