Hi. I would like to build an alphabetical navigation ( A B C .. W Y Z). The idea is that the link will have this format:
echo '<a href = "somepage.php?show=A"> A </a>'
and I will have every letter of the alphabet like that that will be done with a with a "for..."
When the user clicks on the "A" they will open "somepage.php" and I will get the value of "show".
$show = $_GET['show']
.
I will do a query like this:
$query = "SELECT usernames FROM users WHERE usernames LIKE '".$show."%' ";
Now that Im writing this, I wonder, is the above query, case sensitive or case insensitive ? ( will it match 'd%' s and 'D%'s ? )
What I would like to do is to do a query in the first page, to count how many users are in each letter, or if there is at least one user with each letter, whatever is easier.
ie: lets say I have the users : Ana, Charles. (I'd do this for A,B,C instead of the entire A-Z )
The desired output would be:
<a href = "somepage.php?show=A"> A </a>
B
<a href = "somepage.php?show=C"> C </a>
At this moment I can create the desired output doing a count for each letter ( = one query for each letter).
"SELECT COUNT(usernames) FROM users WHERE usernames like "A%"; and so on...
I wonder if this is not efficient and I would like to know if there is another better way of doing it.
Hope some1 can help me about this.
Thanks in advance !
Pablo
PS: I apologize for grammar/ english mistakes.