that's because you print object not array
try this in your controoler
*$jobdetail = $this-Listjobs-find('all');*
*$results = $jobdetail -all();*
*$data = $results-toArray(); in your viewp?= pr($data);exit; ?/por
p?= debug($data);exit; ?/p*
On Tuesday, March 24, 2015 at 11:14:08 AM UTC+7, Quang Nguyễn Ngọc wrote:
Hi I'm a novice in cakephp However, I'm trying to make my blog with
cakephp 3.0 which is stable version. I got stuck not taken database show
view.ctp
Controller = ListjobsController.php
?php
namespace App\Controller;
class ListjobsController extends AppController{
public function jobdetail(){
$jobdetail = $this-Listjobs-find('all');
$this-set( compact('jobdetail'));
}
}
Model =Table = ListjobsTable.php
?php
namespace App\Model\Table;
use Cake\ORM\Table;
class ListjobsTable extends Table{
public function initialize(array $config){
$this-table('listjobs');
$this-displayField('title');
$this-primaryKey('id');
$this-belongsToMany('Users',[
'foreignKey' = 'user_id'
]);
}
}
Template = Listjobs = jobdetail.ctp
p?= pr($jobdetail);exit; ?/p
it does not appear that the current database information:
Cake\ORM\Query Object
(
[sql] = SELECT Listjobs.id AS `Listjobs__id`, Listjobs.user_id AS
`Listjobs__user_id`, Listjobs.type_id AS `Listjobs__type_id`,
Listjobs.cate_id AS `Listjobs__cate_id`, Listjobs.title AS `Listjobs__title`,
Listjobs.location AS `Listjobs__location`, Listjobs.description AS
`Listjobs__description`, Listjobs.skillsrequired AS
`Listjobs__skillsrequired`, Listjobs.companyname AS `Listjobs__companyname`,
Listjobs.website AS `Listjobs__website`, Listjobs.email AS `Listjobs__email`,
Listjobs.password AS `Listjobs__password`, Listjobs.created AS
`Listjobs__created`, Listjobs.modified AS `Listjobs__modified` FROM listjobs
Listjobs
[params] = Array
(
)
[defaultTypes] = Array
(
[Listjobs.id] = integer
[id] = integer
[Listjobs.user_id] = integer
[user_id] = integer
[Listjobs.type_id] = integer
[type_id] = integer
[Listjobs.cate_id] = integer
[cate_id] = integer
[Listjobs.title] = string
[title] = string
[Listjobs.location] = string
[location] = string
[Listjobs.description] = text
[description] = text
[Listjobs.skillsrequired] = text
[skillsrequired] = text
[Listjobs.companyname] = string
[companyname] = string
[Listjobs.website] = string
[website] = string
[Listjobs.email] = string
[email] = string
[Listjobs.password] = string
[password] = string
[Listjobs.created] = datetime
[created] = datetime
[Listjobs.modified] = datetime
[modified] = datetime
)
[decorators] = 0
[executed] =
[hydrate] = 1
[buffered] = 1
[formatters] = 0
[mapReducers] = 0
[contain] = Array
(
)
[matching] = Array
(
)
[extraOptions] = Array
(
)
[repository] = App\Model\Table\ListjobsTable Object
(
[registryAlias] = Listjobs
[table] = listjobs
[alias] = Listjobs
[entityClass] = \Cake\ORM\Entity
[associations] = Array
(
[0] = users
)
[behaviors] = Array
(
)
[defaultConnection] = default
[connectionName] = default
)
)
I can not understand why the data in the database does not appear.
Hope you can help me!!!
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.