drupaldrupal-7drupal-modulesdrupal-ajax

Drupal Search function in custom module


I created a drupal custom module for my website, the module functionality is it display list of students who have registered in my site. Now I want to update my custom module with search functionality, the search function should like google search function.

My custom module look like following structure

current module look like

Now i want to implement the search function in my custom module when i search using the fields of the table like student name,gender,author name,status.how to do this?

Expecting result

Thanks in Advance


Solution

  • If you are going build reports I suggest you to use views instead of constructing the reports yourself. Using functions like...

    views_embed_view
    views_get_view_results
    views_get_view
    

    ... You can do a lot of things: control access, filter data, relate data, paging, etc. You can search more on this functions everywhere.

    Using views for building reports will allow to build not only what you want right now but also what you will need tomorrow, in most of the cases without coding.