PHP 2D Array to MySQL Database
- by Ashley Ward
I have a PHP 2D array, many keys, each with one value, I need to put this into a MySQL database.
The database has 8 fields. Eg. Field1, Field2, Field3, etc. I am trying to ensure value1 => field1, value2 =>field2, value3 => field3 and so on, when one record is full (i.e. after 8 values) a new record should be created for the next 8 values and so on.
I am aware that the 1st, 9th, 17th, 26th values etc, will need an insert statement and the intermediate values will be an update statement.
What is the best way of going about this?