mardi 19 décembre 2017

MySQL query to select the first column containing a NULL or blank value to UPDATE

So I got a small problem thats frustrating me to no end. I have this table that keeps track of multiple subjects characteristics with each subject taking a row in the table. One of them is Identifying marks represented by a dozen columns aptly named idMarks1-12. The subjects begin with a null value, and then I need to UPDATE based on the results of the observations. Namely wounds. The thing is the input update only provides one form field for this so what I am trying to do is test each column to determine the first null or ' ' (particularly for once the wound heals theres another update that can essentially erase it, but that goes down on another page) on the same row. Ive been struggling with IF statements all day and getting nowhere. The idea is that if idMarks4 holds something like "bad right knee", and idMarks1 holds "tattoo sleeve", but idMarks2 thru idMarks3 have been cleared due to time to heal, the UPDATE will jump past idMarks1 and hit idMarks2, then the next one will jump to idMarks3, but the following one will jump to idMarks5 as the others are already filled...the updates all come from a variable determined via $var = $_POST['newIdMark']; and no I am not trying to use any arrays for this whatsoever soooooo any ideas?

Aucun commentaire:

Enregistrer un commentaire