L
L
lex2018-03-21 22:42:08
MySQL
lex, 2018-03-21 22:42:08

How to split requests correctly or what is wrong?

$db = JFactory::getDBO();
  $query = $db->getQuery(true);
  $query->select('a.virtuemart_product_id, a.product_name, a.product_desc, a.slug, p.product_price, c.virtuemart_category_id, cn.category_name, m.virtuemart_media_id, ms.file_url')
      ->from('#__virtuemart_products_ru_ru as a');
  $query->join('LEFT', '#__virtuemart_product_prices AS p ON p.virtuemart_product_id = a.virtuemart_product_id');
  $query->join('LEFT', '#__virtuemart_product_categories AS c ON c.virtuemart_product_id = a.virtuemart_product_id');
  $query->join('LEFT', '#__virtuemart_categories_ru_ru AS cn ON cn.virtuemart_category_id = c.virtuemart_category_id');
  $query->join('LEFT', '#__virtuemart_product_medias AS m ON m.virtuemart_product_id = a.virtuemart_product_id');
  $query->join('LEFT', '#__virtuemart_medias AS ms ON ms.virtuemart_media_id = m.virtuemart_media_id');
  $db->setQuery($query);

  $data = $db->loadObjectList();
  print_r($data);

Greetings, what's wrong here, why can I get only one object, and if I ask for a sheet, then everything goes into a 500 error. Of course, I understand that there are a lot of records, but I'm probably wrong somewhere in the code

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2018-03-21
bem @bemdev

Query the database natively in any database manager and see the error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question