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... Link to comment https://forums.phpfreaks.com/topic/98854-initialize/ 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); ?> Link to comment https://forums.phpfreaks.com/topic/98854-initialize/#findComment-505814 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.