0

Running into some more UserCake problems. Right now I am trying to create a function to update first name (will use for lots of fields), however when I call the function the script stops. For some reason, I believe it doesn't seem to know where the function is? or that it even exists? Because whenever I submit the form, the page stops on the line that I call $loggedInUser->updateFirstName($first_name);

Here's what I'm working with:

funcs.php

if ($first_name != $loggedInUser->first_name) {
    if(trim($first_name) == "") {
        $errors[] = lang("ACCOUNT_SPECIFY_FNAME");
    }

    //End data validation
    if(count($errors) == 0) {
        $loggedInUser->updateFirstName($first_name);
        $successes[] = lang("ACCOUNT_FNAME_UPDATED");
    }
}

user_settings.php

//Change a user's first name
function updateFirstName($id, $first_name)
{
    global $mysqli,$db_table_prefix;
    $stmt = $mysqli->prepare("UPDATE ".$db_table_prefix."users
        SET 
        first_name = ?
        WHERE
        id = ?");
    $stmt->bind_param("si", $first_name, $id);
    $result = $stmt->execute();
    $stmt->close();
    return $result;
}

What I'm confused about is that the updateEmail() function works perfectly, it's exactly the same except for the actual field name being 'email'.

4

1 回答 1

0

看起来您不是在使用该函数调用 id。

$loggedInUser->updateFirstName($id, $first_name);
于 2015-03-20T00:52:38.870 回答