0

I'm trying to have a different image show up based on an integer taken from a SQL table. The SQL is working elsewhere, so I was wondering can anyone tell me why my if/else isn't working?

<% if (data.PatientId === 1) {%>
<img id="imgThumb" src="../images/old_person1.jpg" alt="patient_001">
<%} else if (data.PatientID === 2) {%>
<img id="imgThumb2" src="../images/old_person2.jpg" alt="patient_002">
<%} else if (data.PatientID === 3) {%>
<img id="imgThumb3" src="../images/old_person3.jpg" alt="patient_003">
<%} else if (data.PatientID === 4) {%>
<img id="imgThumb4" src="../images/old_person4.jpg" alt="patient_004">
<% } %>

Edit: data is a variable storing a row of a MySQL table in a for each statement.

Second edit: Thank you tyme, I assumed it was an issue with my code.

0 Answers0