0

I'm trying to add a users access token to my database. I'm using the php mysqlidb connection library.

If I use this function below I get this error:

<b>Warning</b>:  mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables in MysqliDb.php</b> on line <b>1092</b>

function connectUser($id, $fbid, $accessToken) {
    global $db;
    $data = Array (
        'fbid' => $fbid,
        "access_token" => $accessToken
    );
    $db->where ('id', $id);
    $db->update ('users', $data);

}

I know the accessToken has something in it because if I add an echo in the previous function for the accessToken I get this:

CadC5cqRAZArcBAKDZBZBA2AO5Beu1ZBWLFWl5FZClIuFvcx8jvdBZBTv3t3gplq32dm0gw99u62dQAAoBZC71bvgDYjy5RxnpjYzzUWoOlGmlZAwL4gtregzOF9mOqBtp24mybRVMR14mCmuA7YZAJ8kvxfonv151ZAadhlZCi1TKj8I5guOO2YZC2Vfs

Then try to add it manually it works without the error:

 function connectUser($id, $fbid, $accessToken) {
        global $db;
        $data = Array (
            'fbid' => $fbid,
            "access_token" => 'CadC5cqRAZArcBAKDZBZBA2AO5Beu1ZBWLFWl5FZClIuFvcx8jvdBZBTv3t3gplq32dm0gw99u62dQAAoBZC71bvgDYjy5RxnpjYzzUWoOlGmlZAwL4gtregzOF9mOqBtp24mybRVMR14mCmuA7YZAJ8kvxfonv151ZAadhlZCi1TKj8I5guOO2YZC2Vfs'
        );
        $db->where ('id', $id);
        $db->update ('users', $data);

    }

What's going on here?

Ynhockey
  • 3,845
  • 5
  • 33
  • 51
user2570937
  • 802
  • 3
  • 17
  • 34
  • This error refers to the point that in your query you are defining a number of variables but you are not binding all of them to a specific value. It is not a matter of what the value is but of how many. – Lelio Faieta Dec 14 '15 at 09:22

1 Answers1

0

This warning means that one of your input parameters $id, $fbid or $accessToken is empty. Log them somewhere and you will see.

alex b
  • 24
  • 3