I am fairly new to php and I am trying to create a module (1 function at a time). I have a module that I have been working on and I am now at a stand still. I have done many searches on google and on here and I have yet to find what I am looking for. If someone could point me in the right direction on a tutor or document to read I would be greatly appreciated. What I am trying to do is create a form that displays database column names (click able so it can be sorted either ascending or descending) but the data is from different tables within the same database. Then once I have the columns I would like to show the values of certain columns from different tables within the same database but only show a set amount of records from the database (like 10 for example) and have a next or more link (to show the next 10 and so on and so on) . Everything I have searched on and found thus far has not worked. With the examples I have tried not working and then going to next search result with same result I am getting so confused. I have looked at the user.module and user.admin.inc for that is fairly close to what I want to do just with a different database and use multiple tables but I am not sure on it and would prefer if I understood what was going on before I put it in a function and test it.

Comments

jason_gates’s picture

Hi,
What you are looking for is called "tablesort". http://api.drupal.org/api/drupal/includes--tablesort.inc/6 . You can search the Drupal source for the term "tablesort" to get examples (always one of the best places).

I have an example (sorry but it's Drupal 7) here http://public-action.org/content/drupal-7-form-api-making-our-report-sor... . Look at the code for folks_db_report(), I demonstrate how easy it is the page the data. Perhaps that might get you started. At least you'll know what term to search for.

Hope that helps.
Jason

krazykanuk’s picture

Thank you for the extremely quick response. I am going through the links and drupal core and seeing what I can make sense of, and my neighbor loaned me a drupal book (Pro Drupal Development). I actually should sit down with who I creating the site for and see all they want and check if everything they want has been ported to drupal 7, I have a local copy (not added any modules to it other then the default modules that are enabled during install) and just trying to get use to where everything has been moved to and so on, but just using it in my opinion it seems faster. I should take a break from it for tonight and get some rest since I been up all night searching and trying things that ended up not working.

jaypan’s picture

When you're first starting Drupal, things start working right after a few months. Don't expect it after a couple of days.

Contact me to contract me for D7 -> D10/11 migrations.

krazykanuk’s picture

I been using drupal for some time now (roughly about two years), I just now starting to get into the creation of modules and or themes as I learn different aspects of php along the way. I by no means am in a rush if I get this module completely created and working and it takes me two years to do it, I am OK with that as long as it was done properly and I use proper drupal/php coding standards. I would like to finish it much sooner but if it don't get finished sooner I be happy with it working and done right.