[英]$query->where plus AND operator
从Joomla文档中,我了解了如何在php中运行sql查询。
我的代码如下:
$query->select($db->quoteName('customfield_value'));
$query->from($db->quoteName('#__virtuemart_product_customfields'));
$query->where($db->quoteName('virtuemart_custom_id')." = ".$db->quote('322'));
$query->and($db->quoteName('virtuemart_product_id'). " = ".$item->virtuemart_product_id));
$db->setQuery($query);
$results = $db->loadObject();
echo "Factory Code:" . $results->customfield_value;
代码带来了工厂代码,而不是产品的工厂代码,然后我不得不添加行
$查询 - >和......
告诉从特定产品带入工厂代码,但完全没有结果。 最终我在$ query->和上写错了?
有什么想法/解决方案吗?
先感谢您
好的,我找到了正确的答案/语法:
$query->select($db->quoteName('customfield_value'));
$query->from($db->quoteName('#__virtuemart_product_customfields'));
$query->where($db->quoteName('virtuemart_custom_id')." = 322", "AND")
->where($db->quoteName('virtuemart_product_id')." = ". $item->virtuemart_product_id);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.