point me to some php code that prints out the alphabet as links? Example:
I want it to look like this
A B C D E F G H I J and so on.
And when I click on a link I want to send a quary to mySql. If I click on C for example I want the database to give me every post that begins on the letter C, and print it out like this:
Cevin
Cumulus
Alphabetical links
Moderator: General Moderators
Re: Alphabetical links
Code: Select all
foreach(range('a','z') as $i)
{
echo '<a href="">';
echo $i;
echo '</a> | ';
}
You need to put the href to the page and get the variable accordingly..
Re: Alphabetical links
For the MySQL part, use SELECT, LIKE. Search on google.
-
mattpointblank
- Forum Contributor
- Posts: 304
- Joined: Tue Dec 23, 2008 6:29 am
Re: Alphabetical links
EG:
The % sign means match anything after $variable. If $variable is 'a' then it'll match 'aardvark', 'anteater', etc.
Code: Select all
$query = "SELECT * FROM table WHERE article_name LIKE '$variable%'";