Divakarcool
Divakarcool

Reputation: 481

I have some values in comma separated in 4 different columns

i have values like this :-

--------------------------------------------------------------------------
Courses      |       Eligibility       |   Duration      |      Fee


BCA,BBA,MBA      10+2,10+2,Graduation      3Y,3Y,2Y         1Lak,1Lak,2Lak 

and Now I want like :-

--------------------------------------------------------------------------
Courses      |       Eligibility       |   Duration      |      Fee

BCA                     10+2                  3Y                1Lak

BBA                     10+2                  3Y                1Lak

MBA                   Graduation              2Y                2Lak



Note:-  

  <?php $course='BCA,BBA,MBA'; 
        $eligibility='BCA,BBA,MBA';
        $duration='10+2,10+2,Graduation';         
        $fee='1Lak,1Lak,2Lak'; 

   ?>

I don't know how to solve this prob please help me . thanks in advance.

Upvotes: 0

Views: 45

Answers (2)

Divakarcool
Divakarcool

Reputation: 481

I have simply use explode with forearch function.

$tag1=$data['courses_fee'];
$tags = explode(',', $tag1);
foreach($tags as $vals)
{                                                      
echo $vals."\n"; 
}?>

Upvotes: 0

Ben
Ben

Reputation: 9001

Have a look at explode():

$course = "BCA,BBA,MBA";
$course = explode(",",$course);
//$course is now an array of "BCA", "BBA", "MBA"

Upvotes: 1

Related Questions