请建议如何在joomla中使用AND编写以下UPDATE查询.
码:
$query = JFactory::getDbo()->getquery(true);$db =& JFactory::getDBO();$query->update('table1');$query->set('ID = ' . $db->quote($IDname));$query->set ('day='. $db->quote($this->_day));$query->set('ID2 = ' . $ID2);$query->where('ID = '. (int)$IDname) AND('ID2=' .(int)$ID2 );
更新失败,错误是这样的:
//........[something before ]....array(3) { [0]=> string(11) "ID = '1'" [1]=> string(14) "ID2='2'" [2]=> string(17) "date = 2012-04-02" [it seems i got all the value pass to be update] } ["glue:protected"]=> string(4) ","}["where:protected"]=>object(JDatabasequeryElement)#251 (3) { ["name:protected"]=> string(5) "WHERE" ["elements:protected"]=> array(1) { [0]=> string(14) "ID = 2" [where clause is ok ...BUT with AND...] } ["glue:protected"]=> string(5) " AND "}["group:protected"]=> [something is wrong here...?]NulL["having:protected"]=>NulL["columns:protected"]=>NulL["values:protected"]=>NulL["order:protected"]=>NulL["autoIncrementFIEld:protected"]=>NulL}
最佳答案我不确定Joomla更新查询,但我认为它是这样的: – $query->where('ID = '. (int)$IDname);$query->AND('ID2=' .(int)$ID2 );
要么:-
$query->where('ID = '. (int)$IDname . 'AND ID2 = '.(int)$ID2);
总结 以上是内存溢出为你收集整理的mysql – 如何在joomla 1.7中使用AND编写’WHERE’子句条件?我没有数据保存更新全部内容,希望文章能够帮你解决mysql – 如何在joomla 1.7中使用AND编写’WHERE’子句条件?我没有数据保存更新所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)