S
S
semki0962019-04-22 12:37:42
MySQL
semki096, 2019-04-22 12:37:42

What is the reason for the error that occurs when the field is empty?

There is a field in the form priceHere is the handler I can not understand the error that occurs if the field is not filled.
$product->price = $request->getParam('price');

Invalid datetime format: 1366 Incorrect decimal value: '' for column `myshop`.`products`.`price` at row 1 (SQL: update `products` set `price` = where `id` = 61)

I would be grateful for help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2019-04-22
@semki096

You can do this:

$product->price = (int) $request->getParam('price');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question