Joomla 执行mysql查询以从zoo组件zoo版本3表中获取记录
如何执行自定义MySQL查询以从Zoo数据库表中获取记录 类似于此查询的内容:Joomla 执行mysql查询以从zoo组件zoo版本3表中获取记录,joomla,components,zoo,Joomla,Components,Zoo,如何执行自定义MySQL查询以从Zoo数据库表中获取记录 类似于此查询的内容: SELECT "64ccc68f-4af3-4c02-8c0f-8ec5977bacb2" FROM #__zoo_item WHERE application_id=1 and state=1 and type='handy' 读到 根据您在问题中发布的查询,以下为Joomla等效项: $db = JFactory::getDbo(); $query = $db->getQuery(true);
SELECT "64ccc68f-4af3-4c02-8c0f-8ec5977bacb2"
FROM #__zoo_item
WHERE application_id=1 and state=1 and type='handy'
读到
根据您在问题中发布的查询,以下为Joomla等效项:
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('64ccc68f-4af3-4c02-8c0f-8ec5977bacb2')))
->from($db->quoteName('#__zoo_item'))
->where($db->quoteName('application_id') . ' = 1 AND '.
$db->quoteName('state') . ' = 1 AND '.
$db->quoteName('type') . ' = ' $db->quoteName('handy'));
$db->setQuery($query);
$results = $db->loadObjectList();
$results是查询结果的一个对象,您可以使用它执行任何操作
希望这有助于使用zoo API轻松获取所需内容。我必须说他们有最好的API来获取API。使用item get可以获取zoo记录的所有信息,只需将zoo item id传递给函数即可
$app = App::getInstance('zoo');
$item = $app->table->item->get($ITEM_ID); // Zoo Record Id
$Element_Id = "64ccc68f-4af3-4c02-8c0f-8ec5977bacb2"; // One of the text field element id
$element_value = $item->getElement($Element_Id)->getElementData()->get('value');
// $element_value contains the actual value of element id $Element_Id of item id $ITEM_ID.
阅读此博客了解更多信息 你读过关于编写数据库查询的Joomla文档吗?我要求hare获取元素列,该列的json值如下{f04e712e-b17d-4421-83cd-291a7cdd5b6e:{option:{0:videoaufzeichung},8a473b51-7682-4fcd-ac58-c57a35b610dc:{0:{value:200万像素},b203f386-ed38-43f3-b9e8-211ee720c31b:{0:{value:},52f5424f-1776-4011-97bc-918159221fd6:{0:{value:15},9231e9f5-67d0-4147-9eb9-2c832205e19b:{0:{value:4x}请阅读下面的答案并研究Joomla文档以进行数据库查询。将来,请更具体地说明您的需求,这样我们就不会浪费时间编写您不需要的代码
$app = App::getInstance('zoo');
$item = $app->table->item->get($ITEM_ID); // Zoo Record Id
$Element_Id = "64ccc68f-4af3-4c02-8c0f-8ec5977bacb2"; // One of the text field element id
$element_value = $item->getElement($Element_Id)->getElementData()->get('value');
// $element_value contains the actual value of element id $Element_Id of item id $ITEM_ID.