I am using this function to get data from a database.
public function getModelSpecs($modelCode) {
$modelSpecs = db::fetch_array("SELECT * FROM `product_specs` WHERE model='{$modelCode}'");
return $modelSpecs;
}
And i am accessing by using a for loop based on the count of a previous item.
for ($i = 0; $i < count($model); $i++) {
$modelSpecs[] = $product->getModelSpecs($model[$i]['code']);
$count++;
}
echo "<pre>".print_r($modelSpecs, true)."</pre>";
This all works but why is it nesting my array like so, as in its two levels deep.
Array
(
[0] => Array
(
[0] => Array
(
[id] => 183
[model] => ZS125-48A
[engine_brand] => 158FMI-B
)
)
[1] => Array
(
[0] => Array
(
[id] => 172
[model] => STR125YB
[engine_brand] => K154FMI
)
)
Is that just the structure of it as i am already fetching array in the function or can i not make it so that it is only down one level like so:
Array
(
[0] => Array
(
[id] => 183
[model] => ZS125-48A
[engine_brand] => 158FMI-B
)
[1] => Array
(
[id] => 172
[model] => STR125YB
[engine_brand] => K154FMI
)
Thanks