V
V
Vestorben2020-07-06 10:27:53
PHP
Vestorben, 2020-07-06 10:27:53

Mysql does not accept IN value. Why?

Good afternoon, my IN parameter does not accept the second value, and so on, it only displays the first product, numbered: "1". What could be wrong?

I make a request like this:

public function cart() {
    $params = [
      'id' => '1,2',
    ];
    return $this->db->row('SELECT * FROM goods WHERE id IN (:id)', $params);
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2020-07-06
@Vestorben

Accepts. Here's the one and only string you sent and received. The list of values ​​cannot be inserted into IN in this way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question