POST value becomes empty when inserted in MYSQL string, PHP -
i sending values ajax post php file: know getting them because can see values sent in console:
table=menu&colid=mid&id=2&colname=status&value=1
but strange reason when insert them query string:
"update ".$_post['table']." set ".$_post['colname']." = ".$_post['value']." ".$_post['colid']." = ".$_post['id'];
value empty when value = 1!!!
update menu set status = '' mid = '2'
i solved problem changing variable name value val, has experienced similar? value keyword or reserved word?
any thoughts? thanks
this sql
update menu set status = '' mid = '2'
doesn't reflect doing in php. line:
"update ".$_post['table']." set ".$_post['colname']." = ".$_post['value']." ".$_post['colid']." = ".$_post['id'];
otherwise should read:
"update ".$_post['table']." set ".$_post['colname']." = '".$_post['value']."' ".$_post['colid']." = '".$_post['id'] . "'";
mind single quotes in sql statement missing in php code.
besides highly recommend not send parts of sql via ajax client server disclosing internal structure of database listening traffic or peeping data send browser.
Comments
Post a Comment