N
N
Nick Bukovskiy2017-09-28 00:21:36
PHP
Nick Bukovskiy, 2017-09-28 00:21:36

How to fix INSERT INTO problem?

I do INSERT in a database. Connected everything.
Request

$this->dbh->query("INSERT INTO orders (name, phone, city, region, secession, weight, cost, status, np_status, np_id, created_at) VALUES ('".$this->post['name']."', '".$this->post['phone']."', '".$this->post['city']."', '".$this->post['region']."', '".$this->post['npNumb']."', '".$this->post['weight']."', '".$this->post['cost']."', '$this->status', '$statusArr', '$this->ttn', '$this->created')");

Variables checked, they are not empty. The fields from the database are also 100% correct. BUT the data is not added to the database.
Below on the line I do SELECT from this DB from the same table - normally I receive the data. But I can't add. What can be wrong???
I will be glad for any help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2017-09-28
@sonterix

We read phpfaq.ru/pdo
Turn on error output for PDO
Change this horror with variables right in the request code to prepared expressions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question