Welcome Guest, Not a member yet? Register   Sign In
Two arrays, one SQL insert
#1

[eluser]Kemik[/eluser]
Hey guys,

I've got two arrays, one called descriptions and one called prices, both have the same number of entries.

I want to insert a new row into the database for each of the array entries.

E.g.
Descriptions array
Quote:[0] => item 1
[1] => item 2
[2] => item 3

Prices array
Quote:[0] => 9.95
[1] => 12.20
[2] => 10.00

Psuedo query
Quote:Foreach (entry) {
Insert into invoices ($descriptions, $prices)
}

Would generate
Quote:Insert into invoices ('item 1', '9.95')
Insert into invoices ('item 2', '12.20')
Insert into invoices ('item 3', '10.00')

How do I take those two arrays and basically merge them in to one so I can do the foreach?

Thanks


Messages In This Thread
Two arrays, one SQL insert - by El Forum - 03-28-2010, 08:21 AM
Two arrays, one SQL insert - by El Forum - 03-28-2010, 08:33 AM
Two arrays, one SQL insert - by El Forum - 03-28-2010, 08:36 AM
Two arrays, one SQL insert - by El Forum - 03-28-2010, 09:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB