Help Me Solve This PHP Foreach Function - Webmasters - Nairaland
Nairaland Forum › Science/Technology › Webmasters › Help Me Solve This PHP Foreach Function (647 Views)
1 Reply
| Help Me Solve This PHP Foreach Function by internetpo(op): 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? |
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
Open Source News Publishing Script • What Is It With E-topup.com.ng? • Ftp Issue On Godaddy