OK so I've got an array which looks like this
Array
(
[0] => stdClass Object
(
[ipID] => 1
[countryID] => 13
[beginIP] => 1.0.0.0
[endIP] => 1.0.0.255
[netMask] => 24
[beginIPNum] => 16777216
[endIPNum] => 16777471
)
[1] => stdClass Object
(
[ipID] => 2
[countryID] => 44
[beginIP] => 1.0.1.0
[endIP] => 1.0.1.255
[netMask] => 24
[beginIPNum] => 16777472
[endIPNum] => 16777727
)
[2] => stdClass Object
(
[ipID] => 3
[countryID] => 44
[beginIP] => 1.0.2.0
[endIP] => 1.0.3.255
[netMask] => 23
[beginIPNum] => 16777728
[endIPNum] => 16778239
)
)
Now I want to get each set of data (ipID, countryID etc) and write each one to a database, but I'm stuck
How do I get each set of data out ?
foreach($data as $ipRecord ) {
$a = array();
$a['ipID'] = $ipRecord['ipID'];
$a['countryID'] = $ipRecord['countryID'];
echo $a;
}
Using the above throws a Fatal error: Cannot use object of type stdClass as array
$ipRecord-> ipIDformat instead.