Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have first-initial/last-name usernames stored in my database (e.g. jsmith, jdoe). In PHP, I need to display the last names only, which ordinarily would be quite easy with PHP string functions. The rub is that I need the results ordered by the last name, which implies that I need to do a string mod in my query itself. Is this even possible? I've tried something along these lines, but the username field isn't outputting properly (usercomments are getting placed in that spot in my output). Any suggestions?
[syntax="sql"]SELECT SUBSTRING(username,2), userdate, usercomments AS usernameModified, userdate, usercomments FROM mytable ORDER BY usernameModified, userdatefeyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]