Daveyboy Posted December 31, 2006 Share Posted December 31, 2006 I looked at the Mysql manual but cant find a way to seperate two strings with a space. For example,when i run this query in php it comes out "firstnamelastname". I want it to be "firstname lastname".$query = "SELECT CONCAT(firstname,lastname) FROM info WHERE id=$id"; Quote Link to comment Share on other sites More sharing options...
printf Posted December 31, 2006 Share Posted December 31, 2006 Just add a space param between the columns you want to join together.[code]$query = "SELECT CONCAT(firstname, ' ', lastname) AS full_name FROM info WHERE id = " . $id;[/code]printf Quote Link to comment Share on other sites More sharing options...
Daveyboy Posted December 31, 2006 Author Share Posted December 31, 2006 thanks! Quote Link to comment Share on other sites More sharing options...
artacus Posted January 1, 2007 Share Posted January 1, 2007 LOL. With a name like printf, how could he NOT know how to format strings? Quote Link to comment 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.