[eluser]mflammia[/eluser]
Sorry if this is a simple but really struggling to find an answer.
Have the following array returned to the view from a single DB query:
Code:
<?PHP
echo "<pre>";
print_r($person);
echo "<pre>";
?>
Code:
Array
(
[0] => stdClass Object
(
[id_person] => 95
[first_name] => Abbey
[second_name] => Nobody
[dob] => 1973-09-16
[email] =>
[phone] =>
)
)
I can get something like the first name to display by doing something like the following:
Code:
<?php foreach($person as $row):?>
<?php echo $row->first_name ?>
<?php endforeach;?>
Which seems a long winded / incorrect why to go about something that only has one record.
I've tried every combination of coding to just echo a single part of the array, with just a few like:
Code:
echo $person[0]['first_name'];
echo $person ['first_name'];
echo $person->firstname;
Without any luck.
Help much appreciated in advance