How / where to perform string manipulation on result_array? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How / where to perform string manipulation on result_array? (/showthread.php?tid=45977) |
How / where to perform string manipulation on result_array? - El Forum - 10-13-2011 [eluser]Unknown[/eluser] Hi, I'm writing my first CodeIgniter application. I want to display a list of companies with addresses. The addresses are stored in 4 database fields, I want to concatenate these with commas. I am trying to do this in the Model as I figure it's data manipulation. I've concatenated the address fields in the SQL query, but I need to get rid of the double commas that occur if a field is blank. When I try this code, my str_replace function is ignored and I get double commas anyway. Model: Code: <?php Controller: Code: <?php View: Code: <section id="results"> How do I modify $row['address']? Or is there a better approach? Thanks |