Answer the question
In order to leave comments, you need to log in
MySQLi returns empty query, why?
Hello.
Help, I don't understand the problem at all.
Created a mini module, the model sends a SELECT request to receive goods.
In response , nothing , just an empty array, although the request is completely correct. Through phpMyAdmin without errors.
I tried to correct and so on, information related to the oc_product * tables is not displayed at all. Brings out with others.
Request:
SELECT p.`product_id` FROM `oc_product` p LEFT JOIN `oc_product_description` pd ON (p.`product_id` = pd.`product_id`) WHERE pd.`language_id` = '3' AND p.`status` = '1' AND p.`date_available` <= NOW() AND pd.`name` LIKE '%дрова%' ORDER BY p.product_id DESC LIMIT 50
$query = $this->db->query($sql);
public function query($sql) {
$query = $this->connection->query($sql);
if (!$this->connection->errno) {
if ($query instanceof \mysqli_result) {
$data = array();
while ($row = $query->fetch_assoc()) {
$data[] = $row;
}
$result = new \stdClass();
$result->num_rows = $query->num_rows;
$result->row = isset($data[0]) ? $data[0] : array();
$result->rows = $data;
$query->close();
return $result;
} else {
return true;
}
} else {
throw new \Exception('Error: ' . $this->connection->error . '<br />Error No: ' . $this->connection->errno . '<br />' . $sql);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question