I’m trying to insert multiple text fields into MySQL database.
Each text field has a unique index key under a single user id.
The number of indexes will depend on the user.
Is this possible?
I never had to do this before and I was wondering if anyone could help with a little guidance.

I have not written any code for this yet because I’m not sure.


Recommended Answers

All 3 Replies

With mysqli you can perform multiple queries in a single call: http://www.php.net/manual/en/mysqli.multi-query.php check the examples and the comments in the manual to get an idea of the method to apply. If you still have doubts post an example of data you want to submit and the table structure. Bye!

You can also insert multiple sets of values in one query:

INSERT INTO table_name 
(column1, column2, column3)
(value1, value2, value3),
(value4, value5, value6),
(value7, value8, value9)

Thanks for resposes.
I going to re-think question and repost it, thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.