command to ignore errors?

12 years 3 months ago #186112 by ThePiston
command to ignore errors? was created by ThePiston
What do I add to an SQL statement to ignore errors?

CB 2.3, CBsubs 4.3, PHP 7.1, J! 3.9.X

Please Log in to join the conversation.

12 years 3 months ago #186232 by krileon
Replied by krileon on topic Re: command to ignore errors?
You shouldn't ignore errors. What error are you getting?


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 3 months ago #186233 by ThePiston
Replied by ThePiston on topic Re: command to ignore errors?
I'm setting up SQL to add people to a Group for Mailster (new Joomla Listserv extension). Since it's possible to add a 2nd row of exactly the same data, I wanted to make sure that the query ran in the event of an error.

CB 2.3, CBsubs 4.3, PHP 7.1, J! 3.9.X

Please Log in to join the conversation.

12 years 3 months ago #186279 by krileon
Replied by krileon on topic Re: command to ignore errors?
Replace INSERT INTO with INSERT IGNORE INTO and it'll skip the insert if the row is a duplicate. It basically treats what normally would be an error during the insert as a warning so it's skipped over. You can also use REPLACE which will replace any duplicate rows encase you've columns that need up to date information when a user subscribes.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 3 months ago #186282 by ThePiston
Replied by ThePiston on topic Re: command to ignore errors?
that was it, thanks. what about delete? Can I use DELETE IGNORE too in case the row doesn't exist?

CB 2.3, CBsubs 4.3, PHP 7.1, J! 3.9.X

Please Log in to join the conversation.

12 years 3 months ago #186332 by krileon
Replied by krileon on topic Re: command to ignore errors?
Yup, DELETE IGNORE is valid. Below may of be some help understanding what additional properties are available for inserts and deletes. :)

Insert: dev.mysql.com/doc/refman/5.6/en/insert.html
Delete: dev.mysql.com/doc/refman/5.6/en/delete.html


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.178 seconds

Facebook Twitter LinkedIn