2016-07-08 1 views
0


:UPDATE 쿼리 추진 내 로그인 데이터베이스의 테이블에이 쿼리를해야 할 2

Update user set id_ditta = 1 WHERE id = 6;

나는이 방법 (I 이미 만든 모델)을 수행하려고 :

$changeAz = 1; 
$user = 6; 

$update = new Criteria(); 
$where = new Criteria(); 
$update->add(LoginTableMap::COL_ID_DITTA, $changeAz); 
$where->addAnd(LoginTableMap::COL_ID, $user); 
$con = Propel::getWriteConnection(\Model\Model\Map\LoginTableMap::DATABASE_NAME); 
LoginQuery::create()->doUpdate($update,$where, $con); 

페이지 나에게이 오류 메시지가 있습니다 :

Catchable fatal error: Argument 2 passed to Propel\Runtime\ActiveQuery\ModelCriteria::doUpdate() must implement interface Propel\Runtime\Connection\ConnectionInterface, instance of Propel\Runtime\ActiveQuery\Criteria given, called in C:\xampp\htdocs\work\fiogest\template\verifica\cambiaAzienda.php on line 19 and defined in C:\xampp\htdocs\work\fiogest\vendor\propel\propel\src\Propel\Runtime\ActiveQuery\ModelCriteria.php on line 1695


내가 페이지가 나에게주는 생각을 doUpdate 메소드에 두 개의 인수가 필요하기 때문에이 오류가 발생합니다. $ update 또는 $를 삭제하려고 시도하지만 어디에서 쿼리가 작동하지 않고 페이지에 오류 메시지가 나타납니다.

어떻게하면됩니까?
감사합니다.

+0

미안 –

답변

0

같은 것을 사용해보십시오 : 내 질문에 대해 이미 해결 한

$changeAz = 1; 
$user = 6; 

LoginQuery::create() 
    ->filterById($user) 
    ->update([LoginTableMap::COL_ID_DITTA => $changeAz]);