₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,326,958 members, 8,428,817 topics. Date: Thursday, 18 June 2026 at 02:41 AM

Toggle theme

Help Me Solve This PHP Foreach Function - Webmasters - Nairaland

Nairaland ForumScience/TechnologyWebmastersHelp 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?
1 Reply

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 Correct234

Open Source News Publishing ScriptWhat Is It With E-topup.com.ng?Ftp Issue On Godaddy