php - Updating different fields based on whether or not other fields have values -
the query below works fine. following:
- update flag1 = '$uflag'if flag1 empty.
- update flag2 = '$uflag'if flag1 had value in , flag2 empty.
- update flag3 = '$uflag'if flag1 , flag2 have values in them , flag3 empty.
how this?
update submission set votes_up = $votes_up, flag1 = '$uflag'  submissionid = $id 
if want keep query simple, determine sql utilize in php using conditions prior sql's execution.
Comments
Post a Comment