Re: form data

2014-05-24 Thread Andrew Barry
what happens is that the form in  myform2 displays but the id fields are 
blank dropdown.
These fields are not autoincrement.
I submit and I can get the subject field displayed in myform3 but not id or 
date fields.




controller
public  function myform3()
{
   
   if($this->request->is('post')) {
$this->set('tutorInput', $this->request->data);
}
}



myform2 view
   echo $this->Form->create(array('action' => 'myform3'));
echo $this->Form->input('teacher_id');   //text
echo $this->Form->input('student_id');   //text
 echo $this->Form->input('subject');   //text
echo $this->Form->input('sessiondate', 
   array('label' => 'Session'));  
echo $this->Form->input('sessiontime', 
   array('label' => 'time'));  
 echo $this->Form->input('available');  
  echo $this->Form->end('submit'); 
 
myform3 view

  echo ''. $tutorInput['Tutorsession']['subject'].'';
   echo ''. $tutorInput['Tutorsession']['sessiondate'].'';
 echo ''. $tutorInput['Tutorsession']['student_id'].'';
   echo ''. $tutorInput['Tutorsession']['sessiontime'].'';
 echo '';
   

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


Re: 2 tables wont display

2014-05-24 Thread Rob M
It looks like your `posts` table doesn't have a `user_id` column. CakePHP 
convention wants it to have one so Cake can make the association "Posts 
belongs to Users".

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


Re: 2 tables wont display

2014-05-24 Thread Rob M
It looks like your `posts` table doesn't have a `user_id` column. CakePHP 
convention wants it to have one so Cake can make the association "Posts 
belongs to Users".

On Friday, May 23, 2014 12:56:48 AM UTC-4, Andrew Townsley wrote:
>
> I am getting an error on a simple display of 2 tables as i am just 
> learning it.
> I know sql but cakephp is awkward with sql/
>
> Anyway I have
>
> *Error: * SQLSTATE[42S22]: Column not found: 1054 Unknown column 
> 'Post.user_id' in 'on clause'
>
> *SQL Query: * SELECT `Post`.`id`, `Post`.`title`, `Post`.`body`, 
> `Post`.`created`, `Post`.`modified`, `User`.`two`, `User`.`three`, 
> `User`.`id` FROM `jagguy`.`posts` AS `Post` LEFT JOIN `jagguy`.`users` AS 
> `User` ON (`Post`.`user_id` = `User`.`id`) WHERE 1 = 1 
>
> models ( I have 2 tables with 1 files with id in common
>
> class Post extends AppModel
> {
> /*var $name='User';*/
> public $belongsTo = array('User');
> }
>
> class User extends AppModel
> {
> public $hasMany = 'Post';
> }
>
>
> class PostsController extends AppController
> {
> 
> public  function home2()
> {
>
> $everything=  $this->Post->find('all', array('contain' => 
> array('User')));
> } 
>
>
> view
>
> 
>
>   echo ''. $item['Post']['id']. '';
> echo ''. $item['Post']['title'].'';
>echo ''. $item['Post']['body'].'';
>
>
>
>
>  
> *P: (03) 9866 7737*
> *E: in...@itfutures.edu.au *
> *A: Suite 5 / Level 1 / 424 St Kilda Rd, Melbourne, 3004 
> *
>
>
> *Connect with us: *
>
>  
> 
>     
>   
>
> Please consider the environment before printing this email.
>
>  
>
> This e-mail and any attachments to it (the "Communication") is, unless 
> otherwise stated, confidential,  may contain copyright material and is for 
> the use only of the intended recipient. If you receive the Communication in 
> error, please notify the sender immediately by return e-mail, delete the 
> Communication and the return e-mail, and do not read, copy, retransmit or 
> otherwise deal with it. Any views expressed in the Communication are those 
> of the individual sender only, unless expressly stated to be those of 
> National Training and Solutions Provider Pty Ltd ABN 34 123 831 023, or any 
> of its related entities. NTSP does not accept liability in connection with 
> the integrity of or errors in the Communication, computer virus, data 
> corruption, interference or delay arising from or in respect of the 
> Communication.
>

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


Re: load 2 models in controller

2014-05-24 Thread Stephen S
You have a few options really. In your controller, if you feel you will use
the Teacher model in majority of actions/methods you can add this property:

public $uses = array('Teacher');

If you think you will use the Teacher model several times in a single
action, you can use the following:

$this->loadModel('Teacher');

And as Advantage+ put it, if you only need to use the Teacher model one
single time, it may be better to do the following:

ClassRegistry::init('Teacher')->find('all');
(This is the same as $this->Teacher->find('all'), just a single instance)

Finally there is one other option which hasn't really been discussed which
is to use requestAction from within your view, what this does is it calls a
specified controller action and retrieves the result sending it to your
view, but it isn't always a great idea as* it can **carry some overhead
which may slow down your application*.

*In your Teachers controller*

public function list() {
if(empty($this->request->params['requested'])) {
throw new ForbiddenException(__('You cannot access this method
directly'));
}
return $this->Teacher->find('all');
}

*In any view you want to access the teacher list*

$teachers = $this->requestAction('/teachers/list');

http://book.cakephp.org/2.0/en/controllers.html#Controller::$uses
http://book.cakephp.org/2.0/en/controllers.html#Controller::loadModel
https://groups.google.com/forum/#!topic/cake-php/E3xXtOsBAxc
http://book.cakephp.org/2.0/en/controllers.html#Controller::requestAction
http://mark-story.com/posts/view/reducing-requestaction-use-in-your-cakephp-sites-with-fat-models

If none of these help, you may have an issue with your model not being
found (which I think may be the issue already, check the filename, model
name, extends etc that this is correct)


On 24 May 2014 08:28, Andrew Barry  wrote:

> I dont think it should be this complicated.
> You are just loading a model in a controller and i see many examples of
> ths but i cant get it to work.
>
> --
> 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.
>



-- 
Kind Regards
 Stephen Speakman

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


RE: form data

2014-05-24 Thread Advantage+
And show your code to show you made an effort.

We cannot see what your looking at.

 

What have you tried, what was the response, your model / controllers. Your 
trying to do what and this is where your at after doing? Error logs say what?

 

We cant help if you don’t put in the effort yourself.

 

 

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of 
Andrew Barry
Sent: Saturday, May 24, 2014 6:31 AM
To: cake-php@googlegroups.com
Subject: Re: form data

 

Ok I was hoping I wouldnt get such a response.

I have been looking at this book and you have to admit , it just isnt always 
going to help you do a complete example.

data goes back to the controller in a 

$this->request->data['MyModel']['title']; and this means I can do what and 
where ? is there an example anywhere?



http://book.cakephp.org/2.0/en/controllers/request-response.html  //this doesnt 
help

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

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


Re: Fatal error: Out of memory (allocated 10485760)

2014-05-24 Thread Stephen S
Looks like you have a 10MB limit in your php config and you're exceeding
that limit, common with file uploads especially.

http://docs.php.net/manual/en/ini.core.php#ini.memory-limit



On 24 May 2014 03:00, 'Chris' via CakePHP  wrote:

> hi guys,...
> why am I getting this error from time to time,...?
> *Fatal error*: Out of memory (allocated 10485760) (tried to allocate
> 19456 bytes) in
> thanks
> Chris
>
> --
> 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.
>



-- 
Kind Regards
 Stephen Speakman

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


Re: form data

2014-05-24 Thread Andrew Barry
Ok I was hoping I wouldnt get such a response.

I have been looking at this book and you have to admit , it just isnt 
always going to help you do a complete example.

data goes back to the controller in a 

$this->request->data['MyModel']['title']; and this means I can do what and 
where ? is there an example anywhere?


http://book.cakephp.org/2.0/en/controllers/request-response.html  //this 
doesnt help

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


RE: form data

2014-05-24 Thread Advantage+
I also want to build the next best social media website can you tell me 
how. 

I just want you to do it for me and not do any of the work myself J

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of 
Andrew Barry
Sent: Saturday, May 24, 2014 6:02 AM
To: cake-php@googlegroups.com
Subject: form data

 

Hi,

I created a form and a submit button.
After that I want to 
1) display certain fields back to another view  and that means the posted data 
is handled by the controller?
I am really finding this hard to get a complete example on this and cakephp 
book isnt helping as yet.

echo $this->Form->create();

echo $this->Form->input('username');   //text
echo $this->Form->input('password');   //password
echo $this->Form->input('birth_dt', 
   array('label' => 'Date of birth',
  'dateFormat' => 'DMY',
  'minYear' => date('Y') - 70,
  'maxYear' => date('Y') - 18));   
 echo $this->Form->checkbox('done');
echo $this->Form->input('field', array(
'options' => array(1, 2, 3, 4, 5),
'empty' => '(choose one)'));
echo $this->Form->end('submit');

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

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


RE: form data

2014-05-24 Thread Advantage+
Perhaps read the Cookbook on data handling and how to access and use it.

 

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of 
Andrew Barry
Sent: Saturday, May 24, 2014 6:02 AM
To: cake-php@googlegroups.com
Subject: form data

 

Hi,

I created a form and a submit button.
After that I want to 
1) display certain fields back to another view  and that means the posted data 
is handled by the controller?
I am really finding this hard to get a complete example on this and cakephp 
book isnt helping as yet.

echo $this->Form->create();

echo $this->Form->input('username');   //text
echo $this->Form->input('password');   //password
echo $this->Form->input('birth_dt', 
   array('label' => 'Date of birth',
  'dateFormat' => 'DMY',
  'minYear' => date('Y') - 70,
  'maxYear' => date('Y') - 18));   
 echo $this->Form->checkbox('done');
echo $this->Form->input('field', array(
'options' => array(1, 2, 3, 4, 5),
'empty' => '(choose one)'));
echo $this->Form->end('submit');

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

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


form data

2014-05-24 Thread Andrew Barry
Hi,

I created a form and a submit button.
After that I want to 
1) display certain fields back to another view  and that means the posted 
data is handled by the controller?
I am really finding this hard to get a complete example on this and cakephp 
book isnt helping as yet.

echo $this->Form->create();

echo $this->Form->input('username');   //text
echo $this->Form->input('password');   //password
echo $this->Form->input('birth_dt', 
   array('label' => 'Date of birth',
  'dateFormat' => 'DMY',
  'minYear' => date('Y') - 70,
  'maxYear' => date('Y') - 
18));   
 echo $this->Form->checkbox('done');
echo $this->Form->input('field', array(
'options' => array(1, 2, 3, 4, 5),
'empty' => '(choose one)'));
echo $this->Form->end('submit');

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


Re: load 2 models in controller

2014-05-24 Thread Andrew Barry
I dont think it should be this complicated.
You are just loading a model in a controller and i see many examples of ths 
but i cant get it to work.

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