PHP 2D Array to MySQL Database
Posted
by Ashley Ward
on Stack Overflow
See other posts from Stack Overflow
or by Ashley Ward
Published on 2010-04-09T08:52:39Z
Indexed on
2010/04/09
8:53 UTC
Read the original article
Hit count: 355
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?
© Stack Overflow or respective owner