gerkintrigg Posted October 18, 2006 Share Posted October 18, 2006 Hello. I'm trying to take a complete address from a database field and split it using the line break) into seperate values (line one be one variable, line 2 another etc).I've got this code so far but it doesn't work:[code]$addy=$row['Address'];// split the address$chars = preg_split('//', $addy, -1, PREG_SPLIT_OFFSET_CAPTURE);$al1 = $chars[0];[/code]Can anyone help please?? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
xsist10 Posted October 18, 2006 Share Posted October 18, 2006 [code]<?php$addy = explode("\n", $row["Address"]);print_r($addy);?>[/code] Quote Link to comment Share on other sites More sharing options...
gerkintrigg Posted October 18, 2006 Author Share Posted October 18, 2006 Oh how silly... yeah. Thanks very much - I forgot explode --- DUH! ;) Quote Link to comment Share on other sites More sharing options...
xsist10 Posted October 18, 2006 Share Posted October 18, 2006 np. Using preg_split to remove space is like de-shelling peanuts with an anti-tank missle. ;D 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.