开发者

Display a MYSQL field using CAKE

<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开发者_如何学JAVA USERS table in the same database on this page http://whitelabel.neighborrow.com/app/items/view/2


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).


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


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

Is your Users table really called 'First_name' ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜