Jump to content


Photo

alphabetical filter


  • Please log in to reply
1 reply to this topic

#1 genu

genu
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts

Posted 06 September 2006 - 02:31 AM

How to I have it so when I fetch the database, it displays only results starting with a certain letter, and also show the "next" button if th results starting with that letter exceed 30 items?

#2 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 06 September 2006 - 02:43 AM

For the letter you could do something like:

$letter = "A";
$query = "SELECT * FROM table WHERE field LIKE '$letter%'";

Per query or do something like:

$letter = $_GET['letter'];
$query = "SELECT * FROM table WHERE field LIKE '$letter%'";

And in your url have: http://www.domain.co...ge.php?letter=A Or whatever the letter you want.

On the 30 items per page, you need to look into pagination.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users