phpretard Posted March 31, 2008 Share Posted March 31, 2008 How can pull just the first letter from a row in a DB? I need initials only from fisrt and last name. $result = mysql_query("SELECT * FROM table"); while($row = mysql_fetch_array($result)) { $initials=$row['FirstName'] . " " . $row['LastName']; echo "Initials Only"; } mysql_close($con); Thanks for your help... Quote Link to comment Share on other sites More sharing options...
rhodesa Posted March 31, 2008 Share Posted March 31, 2008 This should work: <?php $result = mysql_query("SELECT * FROM table"); while($row = mysql_fetch_array($result)) { $initials=$row['FirstName']{0} . " " . $row['LastName']{0}; echo "Initials Only"; } mysql_close($con); ?> 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.