I need to search details. I have written the code for searching ie, the textbox and search button is written in the homepage as well as the "search_result.php".
Pagination without searching is working well. the searching also is working without pagination.
So I guess if the search value from the homepage is stored in the session then may be I'll get that with pagination.
If there is something more. please help me.. :(
You haven't share code so am in dark what your actually doing or whats wrong.
But there is alternative.
I guess you should try: https://datatables.net/
You does not have to worry about the search results and pagination. datatables takes care of it.
Although datatable in this example fetch all records at once, that may affect on performance if your working with large no of records,
in that case go for : https://datatables.net/examples/data_sources/ajax.html
Let me know if it works for you.
Related
i am having some problems and i was hoping you will help me.
This is the website i'm testing on: http://rblueberry.epizy.com/
So what i want to do is: for all this boxes on website to fetch from database, but in that order, how can i do that?
Do i need to make more tables for those boxes(articles) or i can do it other way?
Sorry if im not explained very well, i really don't know how to explain it better.
I have used ng-table for my table which works well for pagination, sorting. and I have used ng-model for filtering table data (in short search).
My problem is when I do search it is searching but suppose the word I am searching is at page 3 so it not shows anything till I do not do show all records (till I do not remove pagination). I want to remove pagination automatically while search or anything so that the record will come on first page.
Help me, Thanks in advance.
I think you are currently using pagination in client side data.the better approach is to use the searching in server side return result using limit and offset.
Does anyone know of a link to a site that has a tutorial/code on good way to paginate information coming from a database? (without page refresh) I have spent the better part of the day looking for a site that has what I need. Most are dealing with static/fixed data in the forms of lists etc.
I need one that has something like this for my tables:
Data Data Data Data
Data Data Data Data
Records 1 to 8 of 27 First Previous Next Last
We just implemented a few things using this plugin for JQuery:
Datatables.net
It works on basic html tables and has support for AJAX. Basically you would just write a PHP page that returns a partial result from your database in JSON, etc. The plugin will handle making the AJAX call and displaying the data.
This is only a very partial answer (sorry, not much time atm) but look for the 'LIMIT' command in mysql. It lets you pull back only a certain set of records, say records 11-20. I use that when I do pagination.
Again, this isn't complete, but hopefully it'll help!
I've worked with this one quite a bit. jQgrid... seems to be pretty well maintained.
http://www.trirand.com/blog/
You know when you start searching in an autocomplete search box, you get a list of possible results. From those results, say you click one of the items on the list, I want to take that item and perform another search to give another list of results. Just exaclty like how google works. if you dont understand me try typing into google search box something like 'ja'. It will give a list of possible results,when you select one of them, it does another search and gives another set of results.
Pls does anyone know how to do this with scriptalous autocomplete? or anyother way Any example on the net, will really really appreciate it.
I ma using codeigniter frame work (php) by the way
You can definitely do it. Personally I would do it in jQuery using the Autocomplete from jQuery UI.
http://jqueryui.com/demos/autocomplete/
You could get it to load the results like it usually does but format them differently or extend the jquery ui. Would be fairly simple.
Since its possible in jQuery its definitely possible to do with the scriptaculous autocompleter but I am not familiar with it.
You would look at the place where the output is displayed:
<div id="autocomplete_choices" class="autocomplete"></div>
If you can style this the way you want it instead of it being like a dropdown then you will have your instant.
I am just learning php and ended up at this tutorial http://www.w3schools.com/php/php_ajax_livesearch.asp
Till now my PHP search file looks the same as in example but i changed the if (strlen($q) > 0) to if (strlen($q) > 3) to display results after typing minimum 3 words. I am wondering how can i make the results paginate if there are lots of them?
Thanks
Roshan
You would need to page after obtaining the number of records from your database.
Paging should be done by the same script that echos your ajax response.
Here is how to page:
PHP MySQL paging.
The idea of search suggestions is to show the user what do you have in your site, in terms of relevance, that match his query. This being said, you should only throw a subset of results, being the first result the most relevant, instead of the whole file or database. In others words, you don't need pagination.
Show the user 5 or 10 items, if he doesn't find what he's after he'll keep writing until he finds it. If he doesn't finds it he will just search it. Remember that it is a suggestion and nothing more.