我的列的名称具有结构nameUser.Name
,但我无法更新它们。我尝试了几种可能性:
// Ideally, I'd like to do this (since the User.Name is 'dynamic', ie, it depends
// on who is logged in):
$userLogged = 'Some.User';
$columnName = 'name' . $userLogged;
mysql_query("UPDATE Industries SET '$columnName'='$name' WHERE id='$id'");
// Another try:
mysql_query("UPDATE Industries SET $columnName='$name' WHERE id='$id'");
// Alternatively, if the above cannot be achieved:
mysql_query("UPDATE Industries SET 'nameSome.User'='$name' WHERE id='$id'");
// Yet another try:
mysql_query("UPDATE Industries SET nameSome.User='$name' WHERE id='$id'");
但是,上述方法均无效。为什么?