From 0bf58fc2829d7fed6256b4b1e874b91c69db8e5f Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Tue, 22 Aug 2023 19:51:02 +0800 Subject: [PATCH] Course.php: give the code better format; show None if there is no attachment. --- Course.php | 64 +++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/Course.php b/Course.php index e015043..c63fb41 100644 --- a/Course.php +++ b/Course.php @@ -182,50 +182,50 @@ include 'Header.php'; '; } else { while($row = mysqli_fetch_assoc($result)) { - $title=$row['Title']; - $marks=$row['Marks']; - $ins=$row['Instructions']; - $posted=$row['Posted_Date']; - $deadline=$row['Deadline']; - $att1=$row['Attachment_link_1']; - $att2=$row['Attachment_link_2']; - $att3=$row['Attachment_link_3']; - $att4=$row['Attachment_link_4']; - $id=$row['Lab_Report_ID']; + $title = $row['Title']; + $marks = $row['Marks']; + $ins = $row['Instructions']; + $posted = $row['Posted_Date']; + $deadline = $row['Deadline']; + $att1 = $row['Attachment_link_1']; + $att2 = $row['Attachment_link_2']; + $att3 = $row['Attachment_link_3']; + $att4 = $row['Attachment_link_4']; + $id = $row['Lab_Report_ID']; - $full_link="$att1"; + $full_link = "None"; - if($att2!=""){ - $full_link= $full_link."| $att2"; - } - if($att3!=""){ - $full_link= $full_link."| $att3"; + if ($att1 != "") { + $full_link = "$att1"; } - if($att4!=""){ - $full_link= $full_link."| $att4"; + if($att2 != "") { + $full_link = $full_link."| $att2"; } + if($att3 != "") { + $full_link = $full_link."| $att3"; + } + + if($att4 != "") { + $full_link = $full_link."| $att4"; + } + + echo "
MISSED
$title
($marks Marks)

$ins


Posted: $posted     Deadline: $deadline          
Attachments: $full_link


";