小编Bew*_*ong的帖子

如何在joomla 1.7中用AND编写'WHERE'子句条件?我没有数据保存更新

请建议如何在joomla中编写以下UPDATE查询AND.

码:

$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 );
Run Code Online (Sandbox Code Playgroud)

更新失败,错误是这样的:

//........[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) { …
Run Code Online (Sandbox Code Playgroud)

mysql database joomla

5
推荐指数
2
解决办法
1万
查看次数

标签 统计

database ×1

joomla ×1

mysql ×1