waverider Posted January 25, 2010 Share Posted January 25, 2010 I have list of names in my database with page links associated with them. I want to echo out all the entries with their links associated. I want to have it echo out in a list with letter headings. So it would look something like this:AJohn AdamsMarc AndersonDon AslidBBob BackleyDoug BucklandCMartha ConnersJoan CooperLambda Culversetc..... Link to comment Share on other sites More sharing options...
ProblemHelpPlease Posted January 25, 2010 Share Posted January 25, 2010 You would probably be best using some form of regular expression within your SQL query to select the relant entry, alternatively you could pull all the data out then search the results with a similar reg ex to display what you want. I am presuming that your names are not stored last name first. Link to comment Share on other sites More sharing options...
waverider Posted January 25, 2010 Author Share Posted January 25, 2010 You would probably be best using some form of regular expression within your SQL query to select the relant entry, alternatively you could pull all the data out then search the results with a similar reg ex to display what you want. I am presuming that your names are not stored last name first.No I have them stored like this "Jane Doe" so what I did was a preg_split("/[\s,]+/", $row['names']) so that I could put the names into an array so that the last name would be $names[0] = 'Jane' and $names[1] = 'Doe'Would I then just run a large Case Switch or If Else statement to see if the first letter in $names[1] changes? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.