๐Ÿ”’ Closed PHP

Status
Not open for further replies.

xtreme09

Eternal Poster
1648019391626.webp

SOURCE CODE:

<!DOCTYPE html>
<html>
<head>
<title>Test 1</title>
</head>
<body>
<?php
$student = array(
array(
's_id'=>'Student_ID',
'name'=>'Name',
'course'=>'Course',
'yr_s'=>'Year and Section',
'grade'=>'Grade',
),

array(
's_id'=>'123',
'name'=>'Juan',
'course'=>'BSI/T',
'yr_s'=>'2nd Year Everlasting',
'grade'=>'Excellent',
),

array(
's_id'=>'124',
'name'=>'kurt',
'course'=>'BSI/S',
'yr_s'=>'2nd Year Gumamela',
'grade'=>'Good',
),

array(
's_id'=>'125',
'name'=>'Joshua',
'course'=>'BSMT',
'yr_s'=>'2nd Year Ilang-Ilang',
'grade'=>'Good',
),

array(
's_id'=>'126',
'name'=>'Kent',
'course'=>'BSCS',
'yr_s'=>'2nd Year Pagsanjan',
'grade'=>'Failed',
),
);

echo "<br><br><table border =\"3\" style='border-collapse: collapse'>";
foreach($student as $row){
echo '<tr>';
foreach($row as $cell){
echo ('<td>'.$cell.'</td>');
}
echo('<tr>');
}
echo "</table>";


?>
</body>
</html>

Pwede po patulong yung para po dun sa grade di ko po kase makuha yung pag gamit ng condition statement.
 
Look for multi-dimensional array topics on PHP firs. It seem na hindi ka pa marunong sa multi-dimensional arrays.

1648024134423.webp

this might help..No need to run inner loop since you need to get value each column in a row..
 
Status
Not open for further replies.

About this Thread

  • 2
    Replies
  • 336
    Views
  • 3
    Participants
Last reply from:
Katipunero-

Online now

Members online
963
Guests online
855
Total visitors
1,818

Forum statistics

Threads
2,276,261
Posts
28,968,783
Members
1,231,191
Latest member
yonam
Back
Top