J
J
jistulamle2018-03-13 09:55:58
PHP
jistulamle, 2018-03-13 09:55:58

Why isn't updating correctly in PHP PDO database?

The data in the database is not updated correctly.

public function updateRow($query = null, $params = [])
    {
        $result = $this->link->prepare($query);
        $result->execute($params);
    }

$db->updateRow('UPDATE ' . Config::DB_TABLE . ' SET `User` = :User WHERE `id` = :id', [
                'id'    => $row['id'],
                'User' => $User
                ]);

The problem is, if the string is empty, it is normally written, if there is a record, then it just turns out to be an empty string.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
krypt3r, 2018-03-13
@krypt3r

Colon lost before id and User in array

A
Andrey, 2018-03-13
@VladimirAndreev

$User - what is it anyway?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question