nriddock
asked on
simple preg_replace question - remove everything after the comma - inc. the comma
I have a database field "$row_Recordset1['Employee ']" that contains lastname, firstname. I want to strip out everything after the , (including the ,) so that it only displays lastname. Im having difficulty getting preg_replace to do what i want. its still displaying the comma
$lastname = preg_replace('/^([^ ]+).*/','\1', $row_Recordset1['Employee' ]);
any suggestions? Thanks.
$lastname = preg_replace('/^([^ ]+).*/','\1', $row_Recordset1['Employee'
any suggestions? Thanks.
ASKER
Parse error: parse error in /var/www/html/php/project_ status.php on line 135
sorry should be
$lastname = substr($row_Recordset1['Em
ASKER
comma is gone...but now its stripping off the last letter of their name
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that worked!!!
thanks for all your help.
thanks for all your help.
welcome and good luck ;-)
!i!
!i!
try
$lastname = substr($row_Recordset1['Em
HTH
!i!