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
Post a Comment