Multiple choice delete from MySQL

Tye Gehring created the topic: Multiple choice delete from MySQL

I have a form that has one multiple choice field and a submit button. The multiple choice field pulls in data from a database. Once the user hits submit it deletes this row from the database. This works just fine.

However, it only deletes the first selection. It doesn't delete all boxes check. Any help would be appreciated here is my delete query on submit.

DELETE FROM reservation_table WHERE id = "{3}"

What can I do so that all boxes checked get deleted, not just the first one?

#92945

Please Log in or Create an account to join the conversation.


Anoush replied the topic: Multiple choice delete from MySQL

Hello Tye,

Thanks for your inquiry :)

Please note that you should generate the query for each multiple choice. Have you done this way?

Thanks and have a nice day!

#92983

Please Log in or Create an account to join the conversation.


Tye Gehring replied the topic: Multiple choice delete from MySQL

Could you please explain in further detail?

#92993

Please Log in or Create an account to join the conversation.


Anoush replied the topic: Multiple choice delete from MySQL

Dear Tye,

You've added delete query for MySQL right? Please note that this works for each field separately. So it means if you have 10 options (checkboxes) you need to add Multiple choice field 10 times. Each field should have one checkbox.

Thanks and have a great day!

#93009

Please Log in or Create an account to join the conversation.


Tye Gehring replied the topic: Multiple choice delete from MySQL

My checkboxes are pulled in from the database.... the number of checkboxes vary from day to do.... so this means I need to duplicate the delete query 10 times in order for the person to successfully delete 10 items at one time?

So if I am using the value in the query as {3} which is the value of the checkbox field.... will I use that value for every single delete query?

#93035

Please Log in or Create an account to join the conversation.


Tye Gehring replied the topic: Multiple choice delete from MySQL

So I created 10 queries that look like this.....

DELETE FROM reservation_table WHERE id = "{3}"

I selected 6 checkboxes and it still only deleted the first id that I selected.

Just to confirm. I have 1 checkbox field. The options are brought in via MySQL. Each checkbox is an id. So the number of checkboxes vary. I want to select as many checkboxes (ids) as possible and when you hit submit I want it to delete every row with a checkbox (id) that I selected.

Select ID: 1 2 3 4 5 6
Submit

If select box 1, 4, and 6 and hit submit.
I want it to delete the rows containing an id of 1, 4, and 6.

currently, it only deletes box 1.

#93037

Please Log in or Create an account to join the conversation.


Anoush replied the topic: Multiple choice delete from MySQL

Dear Tye,

Unfortunately, it is not possible to check multiple checkboxes and delete them from the database at once.

Thanks and have a good day!

#93055

Please Log in or Create an account to join the conversation.


Time to create page: 0.162 seconds
Powered by Kunena Forum

WORLD-CLASS SUPPORT

We are here for you every step of the way. Turn to our support with any questions you might have about our products and services. Our experienced customer care team is available to help you as fast as we possibly can.

Contact us