php mysql not updating row in proper way -
I have a column that has the name right 1, in this column I want $ $ $ $, but the problem is That's when I update only $ month, value is $ 1, but when I update only $ year does not disappear in $ month, but update columns with $ year old call And the new value is such, month is May and old year 2013, and when I update only with 2014, on its date Aa Output May 201301014, This is my code
& lt; Select id = "month" name = "month" & gt; & Lt; Option value = "Jan" & gt; January & lt; / Options & gt; & Lt; Option value = "February" & gt; February & lt; / Options & gt; & Lt; Option value = "march" & gt; March & lt; / Options & gt; & Lt; Option value = "April" & gt; April & lt; / Options & gt; & Lt; / Select & gt; & Lt; Select ID = "year" name = "year" & gt; & Lt; Option value = "2012" & gt; 2012 & lt; / Options & gt; & Lt; Option value = "2013" & gt; 2013 & lt; / Options & gt; & Lt; Option value = "2014" & gt; 2014 & lt; / Options & gt; & Lt; Option value = "2015" & gt; 2015 & lt; / Options & gt; & Lt; Option value = "2016" & gt; 2016 & lt; / Options & gt; & Lt; / Select & gt; $ Months = @ $ _ post ['month']; $ Years = @ $ _ post ['year']; $ Arr = array ($ month, $ year); $ Possession1 = add ("", $ arr); $ UpdateSale = "Capture of the update sales set = '$ possession1' where id = '$ update_id'"; $ R = mysql_query ($ updateSale); Try it, use isset to check post value; >
if (isset ($ _ POST ['month']) and isset ($ _ POST ['year'])) {$ month = $ _POST ['month']; $ Year = $ _POST ['year']; $ Possession1 = $ month "". $ Year; $ UpdateSale = "Right to update sales set =" "$ possession1." 'Where id =' $ update_id '"; $ r = mysql_query ($ updateSale);}
Comments
Post a Comment