ooda55 Posted December 1, 2010 Share Posted December 1, 2010 Hi there, is it possible to join a variable and a string inside a $_POST variable inside a mysql query (UPDATE in this case) Here is what i am trying to accomplish: $update = "UPDATE mona SET STKFF='$_POST[$counter."NAME"]' WHERE id='$userid'"; if (!mysql_query($update)) { die('Error: ' . mysql_error()); } else echo " <br> Update Complete"; Its the '$_POST[$counter."NAME"]' bit that im worried about, is this possible without having to do: $foo=$counter."NAME" '$_POST[$foo]' Thanks Chris Link to comment https://forums.phpfreaks.com/topic/220375-php-mysql-update-with-joined-variable-and-string/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 1, 2010 Share Posted December 1, 2010 $update = "UPDATE mona SET STKFF='{$_POST[$counter."NAME"]}' WHERE id='$userid'"; Link to comment https://forums.phpfreaks.com/topic/220375-php-mysql-update-with-joined-variable-and-string/#findComment-1141906 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.