Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,246 members, 7,953,926 topics. Date: Friday, 20 September 2024 at 09:07 AM |
Nairaland Forum / Science/Technology / Webmasters / Help Me Solve This PHP Foreach Function (590 Views)
Can You Solve This PHP Problem?? / Help To Correct This Php Mailer Code / @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct (2) (3) (4)
(1) (Reply)
Help Me Solve This PHP Foreach Function by internetpo(m): 12:07am On Mar 27, 2013 |
I queried my database and got the result but I want to add foreach () { echo "," ;} so that it will separate the phone numbers by gotten. $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { echo $row['phone']; foreach (){ echo "," ; } |
Re: Help Me Solve This PHP Foreach Function by Nobody: 12:58am On Mar 27, 2013 |
Try dis: while ($row = mysql_fetch_array($result)) { $phone_nos = explode (',' , $row['phone']); foreach ($phone_nos as $phone_no){ echo "$phone_no<br/>" ; } } |
Re: Help Me Solve This PHP Foreach Function by charliebiz(m): 4:51am On Mar 27, 2013 |
thanks. what if I want to replace the first character of a string and seperate the array by comma. I was thinking of using ltrim or string replace. Any idea? |
(1) (Reply)
Urgent Please! / Urgently Needed / How Do You Take Down A Phishing Website?
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 6 |