Sorting search results into blocks
Posted 06 April 2006 - 10:30 AM
I know the way around this is to display the results into sets of 10 or so, and provide links to "next page" or "11 - 20" etc.
But im not sure exactly how i would go about this. Would the links at the bottom of each page have to link to a separate page which performed the search again, but used the SQL LIMIT function to say LIMIT 10,20 or something along those lines?
Anyone know of any tutorials that cover this??
Posted 06 April 2006 - 11:07 AM
[a href=\"http://www.phpfreaks.com/tutorial_cat/25/Page-Number--Pagination.php\" target=\"_blank\"]Pagination[/a]
Posted 06 April 2006 - 11:38 AM
Now i have another problem! My search sql is playing up! For example, if i search for the word "stan", i know that this only has one occurance in the table im searching. When the search is performed, it brings back 5 results. Each of the results links to the correct entry, but it prints every row in the table in the process (hence bringing back 5 results)
Is there a problem with the query im using?
$sql = "SELECT table1.user_name, table1.user_id FROM table1, table2 WHERE table2.description LIKE '%" . $_POST[keywords] . "%' AND table1.user_id = table2.user_id AND table2.group_id = '2'";
Posted 06 April 2006 - 11:40 PM
Use the DISTINCT keyword
$sql = "SELECT DISTINCT table1.user_name, table1.user_id FROM table1, table2 WHERE table2.description LIKE '%" . $_POST[keywords] . "%' AND table1.user_id = table2.user_id AND table2.group_id = '2'";
Donations gratefully received
|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users