2008年8月27日星期三

Re: [fw-db] Update with where clause!!

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
--
View this message in context: http://www.nabble.com/Update-with-where-clause%21%21-tp19180609p19181103.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: