public function bid($listing) { // extract shard and row id from the souk id. list($shard, $row_id) = Souk\Util::parseId($listing->id); // update the listing with the bidder's info. if (!Transaction::atStart()) { Transaction::add($this->db); } // create the table name $table = $this->table($shard); $sql = "UPDATE {$table} SET bid = %i, proxybid = %i, pricesort = %i, bidder = %i, touch = %i, bidcount = %i WHERE row_id = %i"; $rs = $this->execute($sql, $listing->bid, $listing->proxybid, Souk\Util::calcPriceSort($listing->bid, $listing->quantity), $listing->bidder, $listing->touch, $listing->bidcount, $row_id); // should have affected 1 row. if not, blow up. if ($rs->affected() < 1) { throw new Exception('failed', $db); } }