$select_query2 = "SELECT * FROM EmployeeBirthdayDetails Order By E_ID";
                $employeedetails = mysql_query($select_query2);
                $emp_details = array();
                $j =0;
                while($row2 = mysql_fetch_array($employeedetails))
                        $emp_details[$j] = $row2;

                echo "<table border='1' width='100%'>
                <th>Employee ID</th>
                <th>Employee Name</th>
                <th>Date Of Birth</th>

                    echo "<tr>";
                    echo "<td>" . $empId . "</td>";
                    echo "<td>" . $emp_details[$i]['B_E_Name'] . "</td>";
                    echo "<td>" . $emp_details[$i]['B_E_DOB'] . "</td>";
                    echo "<td align='center'>"."<a href='#' onclick='editdetails(".$empId.");'>Edit</a></td>";
                    echo "<td align='center'><a href='#' onclick='deletedetails(".$empId.");'>Delete</a></td>";
                    echo "</tr>";

                echo "</table>"; 

I want to display the table data in ascending order. But its displayed in the order in which i added it to the table.

Change $select_query2 = "SELECT * FROM EmployeeBirthdayDetails Order By E_ID"; to $select_query2 = "SELECT * FROM EmployeeBirthdayDetails Order By E_ID ASC";

This article has been dead for over six months. Start a new discussion instead.