开发者

Zend Db Update Not working

My table structure is:

TABLE `licenses` (
`id` int(11) NOT NULL auto_increment,
`code` varchar(30) collate utf8_unicode_ci NOT NULL,
`title` varchar(255) collate utf8_unicode_ci NOT NULL,
`description` text collate utf8_unicode_ci NOT NULL,
`license_type` char(1) collate utf8_unicode_ci NOT NULL default 'b',
PRIMARY KEY  (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ;

Currently there is data:

(`id`, `code`, `title`, `description`, `license_type`)
(2, 'asd',开发者_JAVA百科 'asdt', 'asdd', 'b')

My database object is fine and working: $db [Class: Zend_Db_Adapter_Pdo_Mysql ]

I am using this to update:

$data=array( 'id' => 2 , 'code' => 'asd' ,  'title' => 'asdt' , 'description' => 'asdd' , 'license_type' => 'b');

$db->update('licenses' , $data  , $db->quoteInto(" id = ? " , $data['id']));   

Its returning a rowcount = 0; And nothing is being updated in database.

My database is Mysql. Anyone has any idea, whats happening.


The thing is that, $db->update(....) returns '0' even if sql was executed, but data which was provided as the bind parameter ($data above) is the original data contained in table, I mean when sql is not changing the data. So our code cannot rely on returned row count.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜