Mam taki kod
<?php
$puste = '';
$zero = '0';
$zero2 = '0.00';
$zero3 = '0000-00-00 00:00:00';
$duration = 'duration';
$full = 'full';
while (($data = fgetcsv($uchwyt, 1000, ";")) !== FALSE) {
$row;
for ($c=0; $c < $num; $c++)
{
$sql = mysql_query("INSERT INTO `legalnyprogram1`.`probid_auctions` (`name`, `description`, `picpath`, `quantity`, `auction_type`, `start_price`, `reserve_price`, `buyout_price`, `bid_increment_amount`, `duration`, `country`, `zip_code`, `shipping_method`, `shipping_int`, `payment_methods`,
`category_id`, `active`, `payment_status`, `start_time_old`, `end_time_old`, `closed`, `nb_bids`, `max_bid`, `nb_clicks`, `owner_id`, `hpfeat`, `catfeat`,
`bold`, `hl`, `hidden_bidding`, `currency`, `auction_swapped`, `postage_amount`, `insurance_amount`, `type_service`, `enable_swap`, `direct_payment_paid`,
`addl_category_id`, `deleted`, `live_pm_amount`, `live_pm_date`, `live_pm_processor`, `shipping_details`, `hpfeat_desc`, `reserve_offer`, `reserve_offer_winner_id`,
`list_in`, `close_in_progress`, `bid_in_progress`, `bank_details`, `direct_payment`, `apply_tax`, `auto_relist_bids`, `end_time_type`, `approved`, `count_in_progress`,
`listing_type`, `is_offer`, `offer_min`, `offer_max`, `auto_relist_nb`,`is_relisted_item`,`start_time`,`end_time`,`creation_in_progres
`,`creation_date`,`state`,`start_time_type`,`retract_in_progress`,`notif_item_re
isted`,`is_draft`,`nb_offers`,
`start_on_bid`,`discount`,`discount_start_date`,`discount_end_date`,`additional_
ows_titles`,`additional_rows_values`,`listing_template_id`) VALUES ('".$data[3]."', '".$data[12]."','".$puste."','".$data[13]."','".$data[2]."','".$data[14]."','".$zero2."','".$data[17]."','".$zero.'","'.$data[23]."','".$puste."','".$puste."','".$data[30]."',
'".$data[31]."','".$data[37]."','".$data[1]."',
'".$zero."','".$puste."','".$zero3."','".$zero3."','".$zero."','".$zero."','".$zero2."','".$zero."','".$zero."','".$data[19]."','".$data[20]."','".$data[17]."','".$data[18]."',
'".$zero."','".$puste."','".$zero."','".$data[32]."',
'".$data[33]."','".$data[35]."','".$zero."','".$zero."','".$zero."','".$zero."','".$zero2."','".$zero."','".$puste."','".$zero2."','".$zero."','".$data[0]."','".$zero."','".$zero."',
'".$puste."','".$puste."','".$zero."','".$zero."',
'".$duration."','".$data[38]."','".$zero."','".$full."','".$zero."','".$zero2."','".$zero2."','".$data[29]."','".$data[28]."','".$data[21]."','".$zero."','".$zero."','".$zero."',
'".$puste."','".$data[21]."','".$puste."','".$zero."',
'".$data[40]."','".$zero."','".$data[22]."','".$zero."','".$zero."','".$zero."','".$data[4]."','".$data[5]."','".$zero."')");
}
?>
tabela
CREATE TABLE `probid_auctions` (
`auction_id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) character SET utf8 collate utf8_unicode_ci NOT NULL,
`description` longtext character SET utf8 collate utf8_unicode_ci NOT NULL,
`picpath` varchar(255) character SET latin2 NOT NULL DEFAULT '',
`quantity` smallint(6) NOT NULL DEFAULT '0',
`auction_type` varchar(30) collate utf8_polish_ci NOT NULL,
`start_price` double(16,2) NOT NULL DEFAULT '0.00',
`reserve_price` double(16,2) NOT NULL DEFAULT '0.00',
`buyout_price` double(16,2) NOT NULL DEFAULT '0.00',
`bid_increment_amount` double(16,2) NOT NULL DEFAULT '0.00',
`duration` smallint(6) NOT NULL DEFAULT '0',
`country` varchar(100) character SET latin2 NOT NULL DEFAULT '',
`zip_code` varchar(50) character SET latin2 NOT NULL DEFAULT '',
`shipping_method` tinyint(4) NOT NULL DEFAULT '0',
`shipping_int` tinyint(4) NOT NULL DEFAULT '0',
`payment_methods` text collate utf8_polish_ci NOT NULL,
`category_id` int(11) NOT NULL DEFAULT '0',
`active` tinyint(4) NOT NULL DEFAULT '0',
`payment_status` varchar(20) character SET latin2 NOT NULL DEFAULT '',
`start_time_old` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`end_time_old` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`closed` tinyint(4) NOT NULL DEFAULT '0',
`nb_bids` int(11) NOT NULL DEFAULT '0',
`max_bid` double(16,2) NOT NULL DEFAULT '0.00',
`nb_clicks` int(11) NOT NULL DEFAULT '0',
`owner_id` int(11) NOT NULL DEFAULT '0',
`hpfeat` tinyint(4) NOT NULL DEFAULT '0',
`catfeat` tinyint(4) NOT NULL DEFAULT '0',
`bold` tinyint(4) NOT NULL DEFAULT '0',
`hl` tinyint(4) NOT NULL DEFAULT '0',
`hidden_bidding` tinyint(4) NOT NULL DEFAULT '0',
`currency` varchar(100) character SET latin2 NOT NULL DEFAULT '',
`auction_swapped` tinyint(4) NOT NULL DEFAULT '0',
`postage_amount` double(16,2) NOT NULL DEFAULT '0.00',
`insurance_amount` double(16,2) NOT NULL DEFAULT '0.00',
`type_service` varchar(50) collate utf8_polish_ci NOT NULL,
`enable_swap` tinyint(4) NOT NULL DEFAULT '0',
`direct_payment_paid` tinyint(4) NOT NULL DEFAULT '0',
`addl_category_id` int(11) NOT NULL DEFAULT '0',
`deleted` tinyint(4) NOT NULL DEFAULT '0',
`live_pm_amount` double(16,2) NOT NULL DEFAULT '0.00',
`live_pm_date` int(11) NOT NULL DEFAULT '0',
`live_pm_processor` varchar(50) character SET latin2 NOT NULL DEFAULT '',
`shipping_details` mediumtext collate utf8_polish_ci NOT NULL,
`hpfeat_desc` text character SET latin2 NOT NULL,
`reserve_offer` double(16,2) NOT NULL DEFAULT '0.00',
`reserve_offer_winner_id` int(11) NOT NULL DEFAULT '0',
`list_in` varchar(50) character SET latin2 NOT NULL DEFAULT 'auction',
`close_in_progress` tinyint(4) NOT NULL DEFAULT '0',
`bid_in_progress` tinyint(4) NOT NULL DEFAULT '0',
`bank_details` text collate utf8_polish_ci,
`direct_payment` text collate utf8_polish_ci,
`apply_tax` tinyint(4) NOT NULL DEFAULT '0',
`auto_relist_bids` tinyint(4) NOT NULL DEFAULT '0',
`end_time_type` enum('duration','custom') character SET latin2 NOT NULL DEFAULT 'duration',
`approved` tinyint(4) NOT NULL DEFAULT '0',
`count_in_progress` tinyint(4) NOT NULL DEFAULT '0',
`listing_type` enum('full','quick','buy_out') character SET latin2 NOT NULL DEFAULT 'full',
`is_offer` tinyint(4) NOT NULL DEFAULT '0',
`offer_min` double(16,2) NOT NULL DEFAULT '0.00',
`offer_max` double(16,2) NOT NULL DEFAULT '0.00',
`auto_relist_nb` tinyint(4) NOT NULL DEFAULT '0',
`is_relisted_item` tinyint(4) NOT NULL DEFAULT '0',
`start_time` int(11) NOT NULL DEFAULT '0',
`end_time` int(11) NOT NULL DEFAULT '0',
`creation_in_progress` tinyint(4) NOT NULL DEFAULT '0',
`creation_date` int(11) NOT NULL DEFAULT '0',
`state` varchar(100) character SET latin2 NOT NULL DEFAULT '',
`start_time_type` enum('now','custom') character SET latin2 NOT NULL DEFAULT 'now',
`retract_in_progress` tinyint(4) NOT NULL DEFAULT '0',
`notif_item_relisted` tinyint(4) NOT NULL,
`is_draft` tinyint(4) NOT NULL,
`nb_offers` int(11) NOT NULL,
`start_on_bid` tinyint(1) NOT NULL,
`discount` int(11) NOT NULL DEFAULT '0',
`discount_start_date` int(11) NOT NULL,
`discount_end_date` int(11) NOT NULL,
`additional_rows_titles` text collate utf8_polish_ci NOT NULL,
`additional_rows_values` text collate utf8_polish_ci NOT NULL,
`listing_template_id` smallint(6) NOT NULL,
PRIMARY KEY (`auction_id`),
KEY `stats_drafts` (`is_draft`,`owner_id`),
KEY `user_auctions` (`owner_id`,`closed`,`deleted`,`creation_in_progress`,`is_draft`),
KEY `mb_auctions_id` (`deleted`,`owner_id`,`closed`,`creation_in_progress`,`auction_id`),
KEY `user_auctions_end_time` (`closed`,`owner_id`,`end_time`,`deleted`,`creation_in_progress`,`is_draft`),
KEY `auctions_start_time` (`active`,`approved`,`deleted`,`closed`,`creation_in_progress`,`start_time`),
KEY `auctions_nb_bids` (`active`,`approved`,`deleted`,`closed`,`creation_in_progress`,`nb_bids`),
KEY `auctions_max_bid` (`active`,`approved`,`deleted`,`closed`,`creation_in_progress`,`max_bid`),
KEY `auctions_start_price` (`active`,`approved`,`deleted`,`closed`,`creation_in_progress`,`start_price`),
KEY `auctions_name` (`active`,`approved`,`deleted`,`closed`,`creation_in_progress`,`name`),
KEY `auctions_end_time` (`active`,`approved`,`deleted`,`closed`,`creation_in_progress`,`end_time`),
KEY `hp_featured` (`hpfeat`,`active`,`approved`,`closed`,`creation_in_progress`,`deleted`),
KEY `cat_featured` (`catfeat`,`active`,`approved`,`closed`,`creation_in_progress`,`deleted`),
FULLTEXT KEY `name` (`name`),
FULLTEXT KEY `description` (`description`),
FULLTEXT KEY `zip_code` (`zip_code`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci PACK_KEYS=0 COMMENT='Table with auctions details' AUTO_INCREMENT=1 ;
przy wywołaniu kodu otrzymuje
Kod
Column count doesn't match value count at row 1Column count doesn't match value count at row 1Column count doesn't match value count at row 1
nie wiem zupełnie gdzie mogę mieć błąd ;/
Pozdrawiam
Ten post edytował Lejto 30.04.2009, 13:53:49