elseif in php code is not working -


This is my php code and if the statement is not working please help me. thank you in advanced.

  if ($ row = mysql_fetch_array ($ Result 1, MYSQL_ASSOC)) {$ pv = $ row ['pv']; Cv = $ line ['cv'] $; If ($ pv == "first_name") {$ sql1 = "set user fname = '$ cv' where id = '$ id'"; $ Result1 = mysql_query ($ sql1); } Elseif ($ pv == "Last name") {$ sql1 = "User set lname = '$ cv' where id = '$ id'"; $ Result1 = mysql_query ($ sql1); }}  

Your code looks okay so that you can otherwise get rid of < / P>

  if ($ line = mysql_fetch_array ($ result1, MYSQL_ASSOC)) {$ cv = $ row ['cv']; $ Column = "fname"; If ($ line ['PV'] == "last name") {$ column = "lname"; } $ Sql1 = "Update the user $ column = '$ cv' where id = '$ id'"; $ Result1 = mysql_query ($ sql1); }  

Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -