Still couldnt get it to work with the __construct
So i have changed to this:
public function nav($table, $live, $loc) {
/**
* nav returns multiple records from the specified table with conditions
* @param string $table Table name
* @param array $live Set in DB condition to show page 1 = Live, 0 = Not Live
* @return array $loc Set in DB shows location of page in Nav 1 = Top, 0 = Side
*/
$tableConfig = array(
'content' => array(
'id' => PDO::PARAM_INT,
'title' => PDO::PARAM_STR,
'content' => PDO::PARAM_STR,
'live' => PDO::PARAM_INT,
'loc' => PDO::PARAM_INT,
'keywords' => PDO::PARAM_STR,
'metaDesc' => PDO::PARAM_STR
)
);
$dsn = new crud('USER', 'PASSWORD', $tableConfig);
$nav = $dsn->getRecords($table, array('live' => $live, 'loc' => $loc));
$result = count($nav);
$cnt = 0;
$navKey = '<nav><ul>';
while ($cnt < $result) {
foreach ($nav[$cnt] AS $key => $value) {
if (is_numeric($key)) {
unset($key, $value);
} else {
if ($key != 'id' && $key != 'content' && $key != 'live' && $key != 'keywords' && $key != 'metaDesc') {
if ($key == 'title') {
$navKey .= '<li><a href="#">' . $value . '</a></li>';
}
}
unset($key, $value);
}
}
$cnt++;
}
// Facebook include and G+1 code -> see main code page -> put into sep include files for ease of modification
$navKey .= '</ul></nav>';
unset($dsn);
return $navKey;
}
And this works. Think i will just have to work back to see where the annoying issue lays.
@Pritaeas -> many thanks for your assistance good sir.