tags:

views:

35

answers:

3
<div class="nhplft">
  <div class="view_item_title"><i><?= $users["First_name"]["First_name"]; ?> in MANHATTAN has (an)</i> <?= $item["Item"]["item"]; ?><br /></div>

that line of code is pulling the item name from the ITEMS table and the ITEM field... what can i do to display the user first_name from USERS table in the same database on this page http://whitelabel.neighborrow.com/app/items/view/2

+1  A: 

Most likely you pull data in the standard CakePHP manner.

So, if your controller pulls data from the Users model:

$this->set( 'users', $this->User->find('first', ..other conditions..) );

Your view will output the first_name column from the database by doing:

<?php echo $users['User']['first_name']; ?>

If that doesn't make sense, I'd recommend you brush up on Cake (this is Cake-101).

Travis Leleu
+1  A: 

From your view code I think you need to link your models together.

SpawnCxy
A: 

" $users["First_name"]["First_name"]; "

Is your Users table really called 'First_name' ?

Leo
no... users table is called users.. field is first_name
adam
Then you are making a mistake here: $users["First_name"]["First_name"]; Not worthy of a markdown, surely?
Leo
it should probably read $user['User']['first_name'] - note the singular $user (just a vague convention if you only expect one result).
Leo
fair enough i guess it was how the question was framed... sorry... tried to upvote but says you need to edit slightly
adam
Okay, I've edited my text to show more clearly why I asked the question.
Leo