slashpine Posted December 22, 2008 Share Posted December 22, 2008 hope someone will help a non-coder (just a hack) The following displays the results from a db query...I have two questions.... echo ' <td>'.$row['id'].'</td>'; echo ' <td>'.$row['name'].'</td>'; echo ' <td>'.$row['address'].'</td>'; echo ' <td>'.$row['city'].'</td>'; echo ' <td>'.$row['state'].'</td>'; echo ' <td>'.$row['zip'].'</td>'; 1.) how can I make the results display in a table where I can put a heading at the top each column? 2.) how difficult would it be to be able to sort the columns by the "heading" (column name) Thanks... Quote Link to comment https://forums.phpfreaks.com/topic/138074-results-display-question/ Share on other sites More sharing options...
AV1611 Posted December 22, 2008 Share Posted December 22, 2008 You create the <table> tag and the first row before the query then put the query then close it after the query Quote Link to comment https://forums.phpfreaks.com/topic/138074-results-display-question/#findComment-721771 Share on other sites More sharing options...
slashpine Posted December 22, 2008 Author Share Posted December 22, 2008 and the first row can you explain this a little further? Quote Link to comment https://forums.phpfreaks.com/topic/138074-results-display-question/#findComment-721783 Share on other sites More sharing options...
slashpine Posted December 23, 2008 Author Share Posted December 23, 2008 ok I got the first part...can anyone help me or show me an example on how to make the columns sortable by column heading? Quote Link to comment https://forums.phpfreaks.com/topic/138074-results-display-question/#findComment-721822 Share on other sites More sharing options...
MadTechie Posted December 23, 2008 Share Posted December 23, 2008 On the titles your need a link ie <a href="?Sort=Name">Name</a> <a href="?Sort=City">City</a> then on the SQL statment your need yo have ORDER BY $_GET['Sort'] ie $query = "SELECT * FROM table ORDER BY ".$_GET['Sort']; Quote Link to comment https://forums.phpfreaks.com/topic/138074-results-display-question/#findComment-721830 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.