I would like to make a list of links at the top of a page containing the first letter of the members first name but only make the links appear if there is a particular member that has that last name.
I came up with this
$surname_query = "SELECT DISTINCT last_name FROM members ORDER BY last_name";
$getlist = mysql_query($surname_query) or die(mysql_error());
while ($row = mysql_fetch_array($getlist)) {
$surname = substr($row['last_name'], 0, 1);
echo "<a href='?lname=$surname' title='Surname´s beginning with $surname'>$surname</a> ";
}
Problem is it makes a seperate link for each surname it finds, so if there is a member with the surname Stewart and another with Sausages the code returns two links for the letter S.
Is there any way of making the query only return a letter once or any other way anyone can think of to do this?
Turbo Pascal
Original authorAnders Hejlsberg (at Borland)
DeveloperBorland
Release20 November 1983; 42 years ago[1][2]
Operating systemCP/M, CP/M-86, MS-DOS, Windows 3.x, Classic Mac OS
PlatformZ80, x86, 68000, PC-98
https://en.wikipedia.org/wiki/Turbo_Pascal
It was the one language I actually learned to program in. I wasn't very good at it and never used it at work.
If anyone has any personal Turbo Pascal stories or personal accomplishments using it, please take a moment to share. Thanks. Peace
Underpowered and overpriced, both separately and together.
This is to be taken as a "1st gen" (Linux+Proton based), and to wait for the 2nd gen that hopefully is a bit better value/balanced. Or wait for a sale.
The Korean company said that UFS 5.0 integrates the latest embedded memory interface standard from JEDEC and achieves up to 10.8 gigabytes per second (GB/s) transfer speeds. Regarding write speeds, Samsung UFS 5.0 can reach 9.5 GB/s.
ISTM that those are pretty fast speeds for local mobile storage.
The jelly cars were a big part of it, but mainly the theme, tone and chars were more sad than fun. Good tone but kinda misplaced and an overcorrection in a GTA coming from SA which had it all right.
Question
+unabatedshagie Subscriber¹
I have a list of members in my database.
I would like to make a list of links at the top of a page containing the first letter of the members first name but only make the links appear if there is a particular member that has that last name.
I came up with this
$surname_query = "SELECT DISTINCT last_name FROM members ORDER BY last_name"; $getlist = mysql_query($surname_query) or die(mysql_error()); while ($row = mysql_fetch_array($getlist)) { $surname = substr($row['last_name'], 0, 1); echo "<a href='?lname=$surname' title='Surname´s beginning with $surname'>$surname</a> "; }Problem is it makes a seperate link for each surname it finds, so if there is a member with the surname Stewart and another with Sausages the code returns two links for the letter S.
Is there any way of making the query only return a letter once or any other way anyone can think of to do this?
Link to comment
https://www.neowin.net/forum/topic/618171-sql-get-first-letter-of-a-result/Share on other sites
8 answers to this question
Recommended Posts