开发者

php/postgres - print issue on the browser

I am developing a user/login system, wherein I have a small php function below that updates the user val开发者_开发技巧ues in a DB when certain condition is met (i.e. when username and password matches). However, nothing seems to happen on the login page. I am using Ubuntu and on the terminal it shows that the variable $pk_user is empty. The problem is that I want to print the values of pk_user but echo, print_r, var_dump nothing prints anything on the browser. I have CSS styling, would that be the reason? The function is:

/* updateUserField - Updates a field, specified by the field parameter,
   in the user's row of the database, given the pk_user */

public function updateUserField($userkey, $field, $value)
{
    $q = "UPDATE users SET ".$field." = '$value' WHERE pk_user = '$userkey'";

    pg_query($this->link,$q);

    if(pg_last_error($this->link)) {
        return -1;
    }

    return 1;
}

and the error message on command line is:

ERROR: invalid input syntax for integer: "" at character 82 STATEMENT: UPDATE users SET usr_userid = '9bc44a3b3b0b911f7f932f06ab7d7b5c' WHERE pk_user = ''

Of course I connect to DB with pg_connect and that part is working okay.


You're not supplying an integer as the $userkey variable when you call the function. Therefore, the query is failing. Check your code where you actually call the function to determine why an integer isn't being passed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜