JSHINER Posted May 15, 2007 Share Posted May 15, 2007 I am using this: "SELECT vendors.name, SUBSTRING_INDEX(vendors.name, ' ', -1) AS lastname" Which will take "Smith" out of John Smith or "Anderson" out of Mike J. Anserson. Now how can I also create a lastname_alpha to get S or A (just the first character out of the lastname. Quote Link to comment https://forums.phpfreaks.com/topic/51525-how-to-find-a-specific-character-in-a-result/ Share on other sites More sharing options...
JSHINER Posted May 15, 2007 Author Share Posted May 15, 2007 Also another question... when I set that to lastname, and try to call that lastname in the WHERE clause I get the error: Error: Unknown column 'lastname' in 'where clause' What I want is if I use "page.php?last=Smith - I want it to find records where lastname = Smith based on the lastname created above. I am trying: WHERE lastname = $last What am I doing wrong here? Quote Link to comment https://forums.phpfreaks.com/topic/51525-how-to-find-a-specific-character-in-a-result/#findComment-253776 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.