NoobLaPHP Posted March 17, 2014 Share Posted March 17, 2014 (edited) I have a select option and want to include it in my query. $select = mysql_real_escape_string($_POST[select]); if($fetch->where$select){ So if the select value was at 2 it would read if($fetch->where2){ How would i do it? Would if($fetch->where.$select){ work putting in a . ? also in the mysql mysql_query("UPDATE `table` SET `where$select`='input' "); Edited March 17, 2014 by NoobLaPHP Quote Link to comment Share on other sites More sharing options...
Solution NoobLaPHP Posted March 17, 2014 Author Solution Share Posted March 17, 2014 Figured it out. I used $where = "where".$select; if($fetch->$where){ mysql_query("UPDATE `table` SET `$where`='input' "); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.