PHP/mySQL: How do a concatenate a variable in a mysql query?
问题 What is the proper way to concatenate text and a variable in PHP inside a mysql_query? Here is my attempt: page.'$pageID' I want it to output page3 . Here is all of the code (simplified to focus on the mysql_query): if ($_POST['pageProgress']) { $pageProgress = $_POST['pageProgress']; $pageID = 3; $userID = 1; $updateUserProgress = mysql_query("UPDATE test SET page.'$pageID'='$pageProgress' WHERE userID='$userID'") or die(mysql_error()); } All of the code works perfectly if I simply replace