Hephaestus Posted March 1, 2006 Share Posted March 1, 2006 Hello,Firstly, I' d like to apologize if I can't state my problem cleary (not so good in English). Anyway, here's the deal:Currently I'm doing a simple project where products are stored in mysql table with their own ID. I want to display all that data in a html table. But the data must be sorttable and in a separate page, users should have the ability to select (via checkboxes) which columns to display. The filtering I've solved relatively easy, but ordering, only partially. So know I need little help. I'll explain the problem using my code:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<?php// Column filter script, which is include only once, due to the reuse of it when a reload button is clicked.include_once("filterscript.php");//Here I have a sortting code. It's quite simple.$default_sort = 'vid'; // Default sort order by first columnif (!isset ($_GET['order'])) // Checking for sort order { $order = $default_sort; }else { $order = $_GET['order']; }//No comments here :-)include 'sqlconfig.php';include 'sqlconnect.php';//---Fetching and Displaying headings-------------------------------------------$result = mysql_query("SELECT $filt FROM charts ORDER BY $order") or die (mysql_error());$row = mysql_fetch_assoc($result);?><table witdh="100%" border="0" cellpading="4" cellspacing="2"><tr width="100%" bgcolor="#CCCCCC"><?php if (strstr($filt, vid)) {?> <td><a href="<?php print $_SERVER['PHP_SELF']."?order=vid";?>">ID</a></td> <?php } and etc...[/quote]Now, as you can see, I have a not so complex code. Everything is fine, when a user selects which columns to display, and everything is fine, even, when a reload button is clicked, but when the user clicks the header to sort, page reloads with all the columns, not the ones selected by user. It seems, that this click invokes the code to be read entirely from start. The "include_once" does not help here :( How can I write the code, that theclick will only do the reselection of data from table, while not starting from the beginning? And another of topic question: How to make data sort and ASC and DSC by clicking multiple times? :-) Quote Link to comment Share on other sites More sharing options...
Hephaestus Posted March 2, 2006 Author Share Posted March 2, 2006 Anyone? :( Quote Link to comment Share on other sites More sharing options...
Hephaestus Posted March 2, 2006 Author Share Posted March 2, 2006 Ah, nevermind... After a couple of hours, I've solved this problem with a variable passing using sessions. :-) Quote Link to comment 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.