Bruce Gust
asked on
How would I add an array consisting of multiple rows into a database?
Here's comes my array...
row_1->[0], [1], [2], [3], [4]
row_2->[0], [1], [3], [4]
I don't have a consistent number of "cells" with every row. In most of the examples I've seen, it would appear as though a consistency in data is assumed. If I've got things set up like this:
foreach ($page_display as $page)
{
what am I going to put here to, not only "parse" my info into my insert statement, but also accommodate those places where there's not any data?
}
row_1->[0], [1], [2], [3], [4]
row_2->[0], [1], [3], [4]
I don't have a consistent number of "cells" with every row. In most of the examples I've seen, it would appear as though a consistency in data is assumed. If I've got things set up like this:
foreach ($page_display as $page)
{
what am I going to put here to, not only "parse" my info into my insert statement, but also accommodate those places where there's not any data?
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
With the 'array' that you have shown, there is nothing to tell a 'foreach' loop that there is any missing data.
Please use var_export() and show us the data in that format. When you do, please post the CREATE TABLE statement for the applicable table, thanks.