Topic: Sr.No Not coming Properly

I want to show list of my product as below :


    Sr.No | Name | Type
    --------------------
    1     |  aa  | 2
    2     |  bb  | 2
    3     |  cc  | 3
    4     |  dd  | 2
    5     |  cc  | 4


**But its coming as  below **


    Sr.No | Name | Type
    --------------------
    3     |  aa  | 2
    5     |  bb  | 2
    1     |  cc  | 3
    4     |  dd  | 2
    2     |  cc  | 4

Its not that i want order by name , i just want normal sr.no as per entry .. means if i add any entry first then sr.no 1 , 2 , 3 and so on..

But when i add any new entry then its sr.no get changed but it should get last sr.no

Below is what i have tried :

    SELECT (@cnt := @cnt + 1) AS rowNumber, orn.name, orn.type ,  u.* 
    FROM  ofr AS u 
    CROSS JOIN (SELECT @cnt := 0) AS dummy
    LEFT JOIN  or_name AS orn ON u.id=orn.id 
    GROUP BY u.id ORDER BY rowNumber AND u.add_datetime DESC

Listing is call in below way :

    $result =   get_details()
     
    $cols = array( 
            _("Sr.No.")=>array('align'=>'center'),
            _("Name")=>array('align'=>'center'),
            _("Type")=>array('align'=>'center')
           );
    
    $table =& new_db_pager('tablename', $result, $cols, 'ofr','id',10); 
    
    $table->width = "95%";
    
    display_db_pager($table);

**Database :**

    id : bigint(20)        UNSIGNED    No     None    AUTO_INCREMENT

Re: Sr.No Not coming Properly

Even tried  :  _("Sr.No.")=>array('align'=>'center','ord'=>'desc')