sorry for asking , if someone already asked . Here my question : I have this function :
function view_jurusan($uid){ $sql="select jurusan_detil.jurusan_tarif from jurusan inner join jurusan_detil on jurusan.jurusan_uid=jurusan_detil.jurusan_uid where jurusan_detil.jurusan_uid='".$uid."' ORDER by jurusan_detil.jurusan_kolom ASC "; $sqlcek=mysqli_query(connection(),$sql); while($row=mysqli_fetch_assoc($sqlcek)){ $data[]=$row; } return $data; }
at other php page
$view=view_jurusan($uid);
Then i tried print_r($view). and have this result
Array ( [0] => Array ( [jurusan_tarif] => 11 ) [1] => Array ( [jurusan_tarif] => 12 ) [2] => Array ( [jurusan_tarif] => 13 ) [3] => Array ( [jurusan_tarif] => 14 ) [4] => Array ( [jurusan_tarif] => 15 ) [5] => Array ( [jurusan_tarif] => 21 ) [6] => Array ( [jurusan_tarif] => 22 ) [7] => Array ( [jurusan_tarif] => 23 ) [8] => Array ( [jurusan_tarif] => 24 ) [9] => Array ( [jurusan_tarif] => 31 ) [10] => Array ( [jurusan_tarif] => 32 ) [11] => Array ( [jurusan_tarif] => 33 ) [12] => Array ( [jurusan_tarif] => 41 ) [13] => Array ( [jurusan_tarif] => 42 ) [14] => Array ( [jurusan_tarif] => 51 ) )
How to call/echo [jurusan_tarif] => 11 only at php? i already tried echo $view['jurusan_tarif'][0];
not works . Sorry for poor english . Thank you
Advertisement
Answer
Please try as below.
echo $view[0]['jurusan_tarif'];