sql query in it. Then i dont have to worry about bugs with arrays and stuff
so something like
$sql = $db->quoteInto('Update MemEvents SET IsActive= 1 WHERE EventID
=?',$requestEvent ).$db->quoteInto('AND MemberID=?',$requestMember);
$query = $db->query($sql);
...
I definitely would prefer this going the PDO route...
Bill Karwin wrote:
>
>
>
> dele454 wrote:
>>
>> Hi am trying to use the update() of the Zend_Db class for 2 conditions
>> that must be true for the update to take place:
>>
>>
>> $where[] = "EventID = ' ". $requestEvent ."'";
>> $where[] = "MemberID = ' ". $requestMember ."'";
>> $db->update('memevents', $updateColumn,$where);
>>
>> Wherever i run this code my view appears blank. The only thing that makes
>> this code different from that in the ZF doc is that i am inserting
>> parameters from the URL into mine.
>>
>> I dont know why this isnt working strangely when i comment out on of the
>> array declarations then the code runs. :( But i need both conditions!!
>>
>>
>>
>
> Unfortunately not all methods consistently support an array for the
> where-clause parameter.
> This is a long-desired enhancement and there is a bug logged for it:
> http://framework.zend.com/issues/browse/ZF-1726
>
> You can work around this by joining your array into a string:
>
> $where[] = "EventID = ' ". $requestEvent ."'";
> $where[] = "MemberID = ' ". $requestMember ."'";
> $db->update('memevents', $updateColumn, join(' AND ', $where));
>
> Be careful to put spaces in the ' AND ' string, and use parentheses to
> clarify precedence if each term contains OR expressions.
>
> Regards,
> Bill Karwin
>
-----
dee
--
View this message in context: http://www.nabble.com/Update-with-where-clause%21%21-tp19180609p19181511.html
Sent from the Zend DB mailing list archive at Nabble.com.
没有评论:
发表评论