php - PDO update query runs changes no rows. No errors -
so i'm running pdo update working, , reason won't update table...
$business_id = 9874128; $hidden = 1; $query = "update business_property_overrides set hidden=? business_id=?"; try { $stmt = $pdo->prepare($query); $stmt->execute(array($business_id, $hidden)); }
for reason won't update, though no errors. existing tables schema looks this, , data is:
there existing data set business_id = 9874128 , hidden set 0, won't update when run above code.
create table `business_property_overrides` ( `business_id` int(11) not null, `id` int(11) not null auto_increment, `name` varchar(512) not null, `apt_type` varchar(25) default null, `apt_num` varchar(9) default null, `street_address` varchar(255) default null, `city` varchar(255) default null, `state` varchar(255) default null, `zip` varchar(25) default null, `phone` varchar(11) default null, `url` varchar(512) default null, `hours` varchar(100) default null, `openhours` varchar(100) default null, `location` point default null, `yelp` varchar(512) default '0', `twitter` varchar(512) default '0', `hidden` tinyint(1) default '0', `merged` int(11) default null, `closed` tinyint(1) default '0', primary key (`id`), unique key `business_id` (`business_id`), unique key `id` (`id`) ) engine=innodb auto_increment=9874134 default charset=utf8;
the hidden
tinyint
1 characters long
, assigning business_id
7 characters long
, error.
change
$stmt->execute(array($business_id, $hidden));
to:
$stmt->execute(array($hidden,$business_id))
Comments
Post a Comment