I'm retrieving data from a database where it is being called onto a page based on what is in the database. What i want to do is organise this data into a sortable table whereby the user will be able to click on the column header and sort by ascending or descending. The user should be able to click on each row which will bring them to another page and call the data from that particular row. (please see www.tenderme.ie as an example - the homepage has a table that is being called from the database and the user can click on whatever row they wish which will bring them to another page. ) This table isn't sortable but if i got the data in the form of a table i would be happy. As you can see from the attached screenshot, the data is being called into a teble but only the first row is clickable. I think the problem here is that the php code only echoes one <tr> row. I would appreciate if anyone could assist with this. Does anyone know any possible way of organising this into a table (sortable if possible) where the user can hover over each row and click whatever row they want. Thank you. Here is the code which is calling the data from the database...

            $con = mysql_connect("xxx","xxx","xxx"); 
            if (!$con) 
              die('Could not connect: ' . mysql_error()); 

            mysql_select_db("xxx", $con); 

            $result = mysql_query("SELECT * FROM proposal WHERE username = '$username'"); 

            echo "<table cellpadding='0'> 
                <th>Hotel Star</th> 

            while($row = mysql_fetch_array($result)) 
                echo "<tr>"; 
                  echo "<td>" . $row['county'] . "</td>"; 
                  echo "<td>" . $row['starrating'] . "</td>"; 
                  echo "<td>" . $row['checkin'] . "</td>"; 
                  echo "<td>" . $row['checkout'] . "</td>"; 
                echo "</tr>"; 
            echo "</table>"; 

Attachments table_screenshot.jpg 10.33 KB
8 Years
Discussion Span
Last Post by almostbob

what your going to want to do is make a forum for that table and when they click on the header name have it post to it self and then use those vars to sort it in the query

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.