Why it caused an error while inserting multiple data into the database by using foreach statements?
5 Answers
New Answerhttps://code.sololearn.com/W0400zO7jtE0/?ref=app
6/17/2020 6:23:03 PM
Erin5 Answers
New AnswerErin I had modified your front-end part so the checkboxes triggers the relevant alert messages. https://code.sololearn.com/WJ6RCjHTM5ae/?ref=app BUT I still need more information about your table. For example the data types of each of the columns in the "problem" table. Your query was like this; insert into problem(P_ID, description) values('','$chk') Did you check the content of <$chk> before you use it in your query? If the 'description' column accepts varchar family then you should wrap <$chk> value with single quotes. Why are you inserting blank for 'P_ID' column here? And, considering the 'name' property of your checkboxes are different (grouped by engine, brake etc.). I am not sure what you are trying to do. You also did not name the checkboxes using [] which is how it should be if you want to capture them as array from PHP side. See the following thread in SO 👇 https://stackoverflow.com/questions/4997252/get-post-from-multiple-checkboxes
Good job Erin! Now that the case is solved, you can mark the thread by adding [SOLVED] in the thread title. To have everyone be informed : )
Did you know? It cannot be included here in this way as in your attempt. So the code is incomplete. Evaluate is not possible. I would suggest to try to check first if it works only with one query.
SoloLearn Inc.
4 Embarcadero Center, Suite 1455Send us a message