H
H
hesy2019-03-11 21:07:14
Silex
hesy, 2019-03-11 21:07:14

Why does the INSERT function in Doctrine throw a 500 Internal Server Error?

There is a function for inserting data:

$query = $app['qb']->insert('users')
            ->values(
                array(
                    'user'   => '?',
                    'value' => '?'
                )
            )
            ->setParameter(0, $name)
            ->setParameter(1, $value)
        ;
$query->execute();

When called via Ajax, it gives:
POST localhost/users/add 500 (Internal Server Error)

The problem is with $query->execute() on INSERT, because SELECT works.
What could be causing this? Any ideas?
I don't know how to phrase the question correctly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Vlastovskiy, 2019-03-11
@VlastV

And show the code for SELECT which works.
There is a feeling that there is a mistake in naming the qb service instead of db.
Those. should be $app['db']->insert(...);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question