Incorrect User Tablename in SaveProfileToDatabase

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
mobhar
User
Posts: 11724

Incorrect User Tablename in SaveProfileToDatabase

Post by mobhar »

I found an issue regarding the incorrect table name in "SaveProfileToDatabase" function in "phpfn*.php" file, especially if I am using MS SQL Server database with multiple schemas in it. Please have a look at this part of code inside "SaveProfileToDatabase" function:
$sSql = "UPDATE " . ew_QuotedName($UserTable->TableName) .

It will not use the correct User table name, just like defined in EW_USER_TABLE constant in the "ewcfg*.php" file.

Let's say my users table name is "[sm].[sm_users]" and this has been defined correctly in the EW_USER_TABLE constant as following:
define("EW_USER_TABLE", "[sm].[sm_users]", TRUE);

Unfortunately, ew_QuotedName($UserTable->TableName) will return only "sm_users" instead of the correct one: "[sm].[sm_users]".

In other words, this issue will only be happened if we use multiple schema in the database.

So, my suggestion is, please modify this part of code:
$sSql = "UPDATE " . ew_QuotedName($UserTable->TableName) .

become:
$sSql = "UPDATE " . EW_USER_TABLE .

Hope this would help for anyone who encountered the same issue. Thanks.


Post Reply