1,105,546 Community Members

How to arrange tha data in an html table in ascending order?

Member Avatar
nehapitale
Newbie Poster
1 post since Sep 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 
                $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;
                        $j++;
                }

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

                for($i=0;$i<sizeof($emp_details);$i++)
                {
                    $empId=$emp_details[$i]['E_ID'];
                    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.

Member Avatar
Nyight
Junior Poster in Training
99 posts since Aug 2010
Reputation Points: 10 [?]
Q&As Helped to Solve: 22 [?]
Skill Endorsements: 0 [?]
 
0
 

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

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article