Welcome Guest, Not a member yet? Register   Sign In
Looped Insert changes to Select
#3

(This post was last modified: 10-21-2021, 07:25 AM by SoccerGuy3.)

(10-20-2021, 10:00 PM)ikesela Wrote: possible for duplicate data?
Code:
$this->simsModel->replace($data);

Didn't make any difference. Still changing from INSERT to SELECT at the same point.

Code:
REPLACE INTO `inventory_sims` (`vendor_id`, `carrier`, `card_num`, `mdn`, `macid`, `invoicenum`, `cost`, `location`, `notes`, `badcard`, `date_purchased`, `date_activated`, `date_deactivated`, `purchaser`, `is_active`, `customer_id`) VALUES ('4', 'AT&T', '89014104272936906903', '5306918954', '6003474B5143', '', 0, 'lo-p3zd82dgjj', '', '0', '2016-01-01', '2020-08-27', NULL, 'ShastaBeam', '1', 0)
REPLACE INTO `inventory_sims` (`vendor_id`, `carrier`, `card_num`, `mdn`, `macid`, `invoicenum`, `cost`, `location`, `notes`, `badcard`, `date_purchased`, `date_activated`, `date_deactivated`, `purchaser`, `is_active`, `customer_id`) VALUES ('4', 'AT&T', '89014104272936906911', '5306918955', '6003474B7187', '', 0, 'lo-p3zd82dgjj', '', '0', '2016-01-01', '2020-08-27', NULL, 'ShastaBeam', '1', 0)
SELECT 1 FROM `inventory_sims` WHERE `card_num` = '89014104272936906929' LIMIT 1
SELECT 1 FROM `inventory_sims` WHERE `card_num` = '89014104272936906937' LIMIT 1

Thinking about @ikesela post got me to thinking about duplicates. I don't understand why it would be an issue as I am not concerned about it, but I took the first card number after it switched to SELECT statements and sure enough it appears in the data twice. I removed one and the script ran until it hit the next duplicate record.

So, why? What makes it change to SELECT? Why didn't the idea of using ->replace fix the issue?

I love this job! Thanks @ikesela
Reply


Messages In This Thread
Looped Insert changes to Select - by SoccerGuy3 - 10-20-2021, 10:02 AM
RE: Looped Insert changes to Select - by ikesela - 10-20-2021, 10:00 PM
RE: Looped Insert changes to Select - by SoccerGuy3 - 10-21-2021, 07:12 AM
RE: Looped Insert changes to Select - by php_rocs - 10-21-2021, 11:08 AM
RE: Looped Insert changes to Select - by Acuru - 10-21-2021, 11:45 AM
RE: Looped Insert changes to Select - by php_rocs - 10-21-2021, 12:01 PM
RE: Looped Insert changes to Select - by InsiteFX - 10-22-2021, 12:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB