Jump to content

Archived

This topic is now archived and is closed to further replies.

genu

alphabetical filter

Recommended Posts

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?

Share this post


Link to post
Share on other sites
For the letter you could do something like:

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

Per query or do something like:

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

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

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.