how to use looping and array with php -
i newbie in programming php, have output query data database this
name activity payment english activ 20 english activ b 25 english activ c 30 biology activ d 50 biology activ e 60
but want show output this:
name activity payment english activ 20 activ b 25 activ c 30 biology activ d 50 activ e 60
how logic program use php show 1 name in same name?
can solve problem?
database show names same
name activity payment english activ 20 english activ b 25 english activ c 30 biology activ d 50 biology activ e 60
but if want show records as
name activity payment english activ 20 activ b 25 activ c 30 biology activ d 50 activ e 60
you can in php
for example
$datas = $fetched_data; // $fetched_data store data selected database // in php use foreach loop $previous_colm = ""; foreach($datas $data){ if($previous_colm == $data['name']){ // echo without printing column name again echo $data['activity']." ".$data['payment']; }else{ // echo new column name echo echo $data['name']." ".$data['activity']." ".$data['payment']; } $previous_colm = $data['name']; }
now output same want...!!!
Comments
Post a Comment