Page 2 of 2

Posted: Wed Nov 09, 2005 5:50 pm
by vincenzobar
Warning: array_map(): Argument #2 should be an array in /home/vincenzoba/domains/underwaterdesign.com/public_html/xml/output-rate.php on line 98

Warning: implode(): Bad arguments. in /home/vincenzoba/domains/underwaterdesign.com/public_html/xml/output-rate.php on line 99
('', '')Column count doesn't match value count at row 1

Posted: Wed Nov 09, 2005 5:53 pm
by Burrito
there you go :)

1) there's no reason to use array_map() the way you were
2) implode() should be obvious
3) Shiz hit that one on the head, define your cols when you do an insert.

Posted: Wed Nov 09, 2005 5:55 pm
by vincenzobar
there are 28 columns and 29 in archive

array map is to add a \ to ' in the insert values nothing else worked

all values add up to columns so there should be no need.

it runs fine for 120 inserts then stops and produces that error, why after 120 inputs?

Posted: Wed Nov 09, 2005 7:20 pm
by vincenzobar
also, when i comment out the delete statement it goes through fine.

WHY GOOOD WHYYYYYYYYY

Posted: Wed Nov 09, 2005 10:19 pm
by vincenzobar
The error comes when there are duplicate product ID in the table.

so if the datadump XML sheet has say 20 duplicates of P-id 12345 then it dies.

This is good and bad. Good because it shows there is an error in the dump. bad because it fails to continue the rest of the script so if i get a bad dump it could mess up the whole table.

I guess i need to add a check like if row is there more than once then delete all duplicates.

Anyone know how i should go about this?

Anyone know any short cuts for this???

thanks for all your guys/gals(if any here) help!!!

your the greatest!

Posted: Thu Nov 10, 2005 3:33 am
by n00b Saibot
vincenzobar wrote:I guess i need to add a check like if row is there more than once then delete all duplicates.
Delete where :?:

Posted: Thu Nov 10, 2005 3:45 am
by Jenk
If you are wanting to delete duplicates from the array, then use array_unique()

Posted: Thu Nov 10, 2005 7:11 am
by vincenzobar
after much studying of the XML file it turns out that they are not REALLY Duplicates. The only difference is that the "rateplanid" is different.

Howerver this is causing a problem on delete because i am deleteing where productid is the same and for some reason as soon as it hits a duplicate id the array breaks and i get all the warnings above.

is there code that will realize this fact or is there a way to delete where product id match DB and XML Dump for every rateplanid that exists with XML product id.... i know confusing...

here is the output and as you can see it goes to delete something that isn't there... i think how do i get around this. BTW, i tested this script on another file without rateplan and it worked perfectly.
DELETE FROM CB_rateplan WHERE productid = 53643;('', '121', 'US Cellular National Plan w/ 1200', '1200', '59.9500', '0.4000', '0', '0', 'included ($0.00/min)', '24', '$150.00', '', '', '0', '', '0', '', '0', 'included ($0.00/min)', '', '', 'monday - friday 9:00pm to 6:59am; weekends friday 9:00pm to monday 6:59am', '', '53639', 'u.s. cellular', 'images/carriers/', 'uscellular_l.gif', 'false', '13821')

DELETE FROM CB_rateplan WHERE productid = 53639;('', '122', 'US Cellular National Plan w/ 2000', '2000', '99.9500', '0.3000', '0', '0', 'included ($0.00/min)', '24', '$150.00', '', '', '0', '', '0', '', '0', 'included ($0.00/min)', '', '', 'monday - friday 9:00pm to 6:59am; weekends friday 9:00pm to monday 6:59am', '', '53641', 'u.s. cellular', 'images/carriers/', 'uscellular_l.gif', 'false', '13857')

DELETE FROM CB_rateplan WHERE productid = 53641;
Warning: array_map(): Argument #2 should be an array in /home/vincenzoba/domains/underwaterdesign.com/public_html/xml/output-rate.php on line 99

Warning: implode(): Bad arguments. in /home/vincenzoba/domains/underwaterdesign.com/public_html/xml/output-rate.php on line 100
('', '')Column count doesn't match value count at row 1

Posted: Thu Nov 10, 2005 10:05 am
by vincenzobar
nevermind i just made a script for each XML File. one sorts by product id for equipment and the other sorts by rateplanid for rate plan. Basically it needs to be a unique key i guess

thanks for all the help!!!

I'll be back!! *Arnold voice*