TRIMMING NAME TO INITIAL ONLY

Trying to trim PHP field (MySQL) output of string to only show initial character – “Andrew” becomes “A”

Have tried many variations on this:

<?php echo $row_rs1[LEFT('fname', 1)]; ?>

This produces the following error:

Fatal error: Call to undefined function LEFT() in /home/ibtib/public_html/dbc/ccl_list.php on line 107

How can I make this work?

Did you try to see if there was a left function?

http://php.net/manual/en/function.substr.php

Your trying to use a mysql function in PHP. Do it in the query.

SELECT LEFT(fname, 1)
FROM table;

Sponsor our Newsletter | Privacy Policy | Terms of Service