K
K
Karen Mnatsakanyan2017-10-28 12:30:17
PHP
Karen Mnatsakanyan, 2017-10-28 12:30:17

Displays id of all products by category id?

Hi all!
I am trying to make a sql query but the result is zero
code

public function getProductCategory($category_id) {
    $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$category_id . "'");

    return $query->rows;
  }

Here is the table prntscr.com/h31zm8 from here you need to select all products by category_id.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Melkij, 2017-10-28
@melkij

select all products by category_id

Well, really?
Go relax, take a walk or sleep.

D
Denis Ruchiev, 2017-10-28
@denis_bardak

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE category_id = '" . (int)$category_id . "'");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question