php - Error when trying an additional SET command in query -


the mysql query below works is. replaces field votes_up in mysql database whatever value there variable $votes_up.

update submission     set votes_up = $votes_up   submissionid = $id 

however, when try add second condition simultaneously replace field called flag1 value of variable called $uflag, error message. query i'm trying use below. error message says unknown column 'admin' in 'field list' if value of $uflag "admin". also, value of $uflag not being put database. ideas why getting error?

update submission    set votes_up = $votes_up,         flag1 = $uflag   submissionid = $id 

you need add quotes string values:

update submission  set votes_up = $votes_up, flag1 = $uflag  submissionid = $id 

should be:

update submission  set votes_up = $votes_up, flag1 = '$uflag'  submissionid = $id 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -