gpt4 book ai didi

php - joomla 中的内部连接查询

转载 作者:行者123 更新时间:2023-11-29 03:57:42 25 4
gpt4 key购买 nike

我想在我的 joomla 站点中触发一个复杂的查询。我为此编写了以下代码。

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('`chr`.`characteristic_id`,`chr`.`characteristic_value`,`prc`.`price_value`');
$query->from('`#___hikashop_product` AS `pdt`');
$query->join('inner', '`#__hikashop_variant` AS `vari` ON `pdt`.`product_id` = `vari`.`variant_characteristic_id`');
$query->join('inner', '`#__hikashop_characteristic` AS `chr` ON `vari`.`variant_characteristic_id` = `chr`.`characteristic_id`');
$query->join('inner', '`#__hikashop_price` AS `prc` ON `pdt`.`product_id` = `prc`.`price_product_id`');
$query->where('`pdt`.`product_id` = 68');
$db->setQuery($query);

查询正在我的本地 mysql 中执行。任何帮助将不胜感激

最佳答案

你可以试试这个

$db->setQuery("Your query");
$result = $db->query();

//if you need the count
$rowcount = $db->getNumRows();

//if the result is multiple rows
$result_array = $db->loadAssocList() or $db->loadObjectList();

//if the result is single row you can use
$result = $db->loadAssoc() or $db->loadObject();

关于php - joomla 中的内部连接查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10350334/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com