cant edit but can add row cakephp

2014-05-28 Thread jagguy
Hi,

In cakephp I cant edit a row from my mysql db but I can add a new row  on 
the same table without error.
Not sure what to do or how to debug this. The edittutorsession function is 
the problem

Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an 
error in your SQL syntax; check the manual that corresponds to your MySQL 
server version for the right syntax to use near 'setFlash' at line 1

public function addtutorsession() {

 
$te= $this-Tutorsession-Teacher-find('list', array('fields' =  
'Teacher.fullname'));
 $this-set( 'te',$te);
 
$this-set( 'st',$this-Tutorsession-Student-find('list', array('fields' 
= array('Student.fullname') )));
 
   
 if ($this-request-is('post')) {
$this-Tutorsession-create();
if ($this-Tutorsession-save($this-request-data)) {
$this-Session-setFlash(__('Your post has been saved.'));
return $this-redirect(array('action' = 'displayall'));
}
$this-Session-setFlash(__('Unable to add your post.'));
}

}


public function edittutorsession($id = null) {


$te= $this-Tutorsession-Teacher-find('list', array('fields' =  
'Teacher.fullname'));
 $this-set( 'te',$te);
 
$this-set( 'st',$this-Tutorsession-Student-find('list', array('fields' 
= array('Student.fullname') )));
 


if (!$id) {
throw new NotFoundException(__('Invalid post'));
}

$post = $this-Tutorsession-findById($id);
if (!$post) {
throw new NotFoundException(__('Invalid post'));
}

if ($this-request-is(array('post', 'put'))) {
$this-Tutorsession-id = $id;
if ($this-Tutorsession-save($this-request-data)) {
$this-Tutorsession-setFlash(__('Your post has been updated.'));
return $this-redirect(array('action' = 'displayall'));
}
$this-Session-setFlash(__('Unable to update your post.'));
}

if (!$this-request-data) {
$this-request-data = $post;
}
}


///
view edittutorsession

?php
echo $this-Form-create('Tutorsession');
 echo $this-Form-input('teacher_id', array('options' = $te));
 echo $this-Form-input('student_id', array('options' = $st));

 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('Save Post');
?




-- 
 http://itfutures.edu.au?referer=email
*P: (03) 9866 7737*
*E: i...@itfutures.edu.au i...@itfutures.edu.au*
*A: Suite 5 / Level 1 / 424 St Kilda Rd, Melbourne, 3004 
https://www.google.com.au/url?sa=trct=jq=esrc=ssource=webcd=15cad=rjauact=8ved=0CKQBEPUXMA4url=http%3A%2F%2Fmaps.google.com.au%2Fmaps%3Fgl%3Dau%26hq%3Ditfutures%26daddr%3D1%2F424%2BSt%2BKilda%2BRd%2C%2BMelbourne%2BVIC%2B3004%26panel%3D1%26f%3Dd%26fb%3D1%26geocode%3DFdKovv0dMSWkCCnfp02hHWjWajGLbygrlMPvUw%26cid%3D6048267865728511883ei=hHUYU_abH8-okgXV7oGYDgusg=AFQjCNEBpgXrGRhNzMxOzPLHRVSQkdpXUQbvm=bv.62577051,d.dGI*


-- 
*Connect with us: *

http://plus.google.com/+itfutureseduau 
http://linkedin.com/company/it-futures
  http://youtube.com/user/itfutureseduau  http://twitter.com/itfutures 
http://facebook.com/itfutures

-- 


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: cant edit but can add row cakephp

2014-05-28 Thread Jeremy Burns : Class Outfit
What happens when you try the save? Does it create a new row instead or does it 
fail somewhere?

On 28 May 2014, at 15:10, jagguy and...@itfutures.edu.au wrote:

 Hi,
 
 In cakephp I cant edit a row from my mysql db but I can add a new row  on the 
 same table without error.
 Not sure what to do or how to debug this. The edittutorsession function is 
 the problem
 
 Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an 
 error in your SQL syntax; check the manual that corresponds to your MySQL 
 server version for the right syntax to use near 'setFlash' at line 1
 
 public function addtutorsession() {
 
  
 $te= $this-Tutorsession-Teacher-find('list', array('fields' =  
 'Teacher.fullname'));
  $this-set( 'te',$te);
  
 $this-set( 'st',$this-Tutorsession-Student-find('list', 
 array('fields' = array('Student.fullname') )));
  

  if ($this-request-is('post')) {
 $this-Tutorsession-create();
 if ($this-Tutorsession-save($this-request-data)) {
 $this-Session-setFlash(__('Your post has been saved.'));
 return $this-redirect(array('action' = 'displayall'));
 }
 $this-Session-setFlash(__('Unable to add your post.'));
 }
 
 }
 
 
 public function edittutorsession($id = null) {
 
 
 $te= $this-Tutorsession-Teacher-find('list', array('fields' =  
 'Teacher.fullname'));
  $this-set( 'te',$te);
  
 $this-set( 'st',$this-Tutorsession-Student-find('list', 
 array('fields' = array('Student.fullname') )));
  
 
 
 if (!$id) {
 throw new NotFoundException(__('Invalid post'));
 }
 
 $post = $this-Tutorsession-findById($id);
 if (!$post) {
 throw new NotFoundException(__('Invalid post'));
 }
 
 if ($this-request-is(array('post', 'put'))) {
 $this-Tutorsession-id = $id;
 if ($this-Tutorsession-save($this-request-data)) {
 $this-Tutorsession-setFlash(__('Your post has been updated.'));
 return $this-redirect(array('action' = 'displayall'));
 }
 $this-Session-setFlash(__('Unable to update your post.'));
 }
 
 if (!$this-request-data) {
 $this-request-data = $post;
 }
 }
 
 
 ///
 view edittutorsession
 
 ?php
 echo $this-Form-create('Tutorsession');
  echo $this-Form-input('teacher_id', array('options' = $te));
  echo $this-Form-input('student_id', array('options' = $st));
 
  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('Save Post');
 ?
 
 
 
 
 P: (03) 9866 7737
 E: i...@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.

-- 
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: cant edit but can add row cakephp

2014-05-28 Thread Advantage+
Not trying to interrupt the answer,

 

Just looking at the code and any future developer if you left the project..

 

Name the $vars

 

$t means? Teacher, call it teacher...

 

$st? 1 date away from std? 

 

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of Jeremy Burns : Class Outfit
Sent: Wednesday, May 28, 2014 11:47 AM
To: cake-php@googlegroups.com
Subject: Re: cant edit but can add row cakephp

 

What happens when you try the save? Does it create a new row instead or does
it fail somewhere?

 

On 28 May 2014, at 15:10, jagguy and...@itfutures.edu.au wrote:





Hi,

In cakephp I cant edit a row from my mysql db but I can add a new row  on
the same table without error.
Not sure what to do or how to debug this. The edittutorsession function is
the problem

Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'setFlash' at line 1

public function addtutorsession() {

 
$te= $this-Tutorsession-Teacher-find('list', array('fields' =
'Teacher.fullname'));
 $this-set( 'te',$te);
 
$this-set( 'st',$this-Tutorsession-Student-find('list',
array('fields' = array('Student.fullname') )));
 
   
 if ($this-request-is('post')) {
$this-Tutorsession-create();
if ($this-Tutorsession-save($this-request-data)) {
$this-Session-setFlash(__('Your post has been saved.'));
return $this-redirect(array('action' = 'displayall'));
}
$this-Session-setFlash(__('Unable to add your post.'));
}
 
}
 
 
public function edittutorsession($id = null) {


$te= $this-Tutorsession-Teacher-find('list', array('fields' =
'Teacher.fullname'));
 $this-set( 'te',$te);
 
$this-set( 'st',$this-Tutorsession-Student-find('list',
array('fields' = array('Student.fullname') )));
 


if (!$id) {
throw new NotFoundException(__('Invalid post'));
}
 
$post = $this-Tutorsession-findById($id);
if (!$post) {
throw new NotFoundException(__('Invalid post'));
}
 
if ($this-request-is(array('post', 'put'))) {
$this-Tutorsession-id = $id;
if ($this-Tutorsession-save($this-request-data)) {
$this-Tutorsession-setFlash(__('Your post has been
updated.'));
return $this-redirect(array('action' = 'displayall'));
}
$this-Session-setFlash(__('Unable to update your post.'));
}
 
if (!$this-request-data) {
$this-request-data = $post;
}
}
 
 
///
view edittutorsession
 
?php
echo $this-Form-create('Tutorsession');
 echo $this-Form-input('teacher_id', array('options' = $te));
 echo $this-Form-input('student_id', array('options' = $st));
 
 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('Save Post');
?

 


 http://itfutures.edu.au/?referer=email 

P: (03) 9866 7737

E: i...@itfutures.edu.au

A: Suite 5 / Level 1 / 424 St Kilda Rd, Melbourne, 3004
https://www.google.com.au/url?sa=trct=jq=esrc=ssource=webcd=15cad=rja
uact=8ved=0CKQBEPUXMA4url=http%3A%2F%2Fmaps.google.com.au%2Fmaps%3Fgl%3Da
u%26hq%3Ditfutures%26daddr%3D1%2F424%2BSt%2BKilda%2BRd%2C%2BMelbourne%2BVIC%
2B3004%26panel%3D1%26f%3Dd%26fb%3D1%26geocode%3DFdKovv0dMSWkCCnfp02hHWjWajGL
bygrlMPvUw%26cid%3D6048267865728511883ei=hHUYU_abH8-okgXV7oGYDgusg=AFQjCNE
BpgXrGRhNzMxOzPLHRVSQkdpXUQbvm=bv.62577051,d.dGI 

 

  http://i.imgur.com/TtxQ71L.jpg 

 

Connect with us: 

 

 http://plus.google.com/+itfutureseduau
http://linkedin.com/company/it-futures
http://youtube.com/user/itfutureseduau   http://twitter.com/itfutures
http://facebook.com/itfutures 

 

  http://campaign.vmware.com/imgs/vmworld/2008/misc_enviro.gif 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

Re: cant edit but can add row cakephp

2014-05-28 Thread Andras Kende
 

Change :
$this-Tutorsession-setFlash
To 
$this-Session-setFlash

Andras Kende
http://www.kende.com/

On Wednesday, May 28, 2014 7:10:55 AM UTC-7, jagguy wrote:

 Hi,

 In cakephp I cant edit a row from my mysql db but I can add a new row  on 
 the same table without error.
 Not sure what to do or how to debug this. The edittutorsession function is 
 the problem

 Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an 
 error in your SQL syntax; check the manual that corresponds to your MySQL 
 server version for the right syntax to use near 'setFlash' at line 1

 public function addtutorsession() {
 
  
 $te= $this-Tutorsession-Teacher-find('list', array('fields' =  
 'Teacher.fullname'));
  $this-set( 'te',$te);
  
 $this-set( 'st',$this-Tutorsession-Student-find('list', 
 array('fields' = array('Student.fullname') )));
  

  if ($this-request-is('post')) {
 $this-Tutorsession-create();
 if ($this-Tutorsession-save($this-request-data)) {
 $this-Session-setFlash(__('Your post has been saved.'));
 return $this-redirect(array('action' = 'displayall'));
 }
 $this-Session-setFlash(__('Unable to add your post.'));
 }

 }


 public function edittutorsession($id = null) {
 
 
 $te= $this-Tutorsession-Teacher-find('list', array('fields' =  
 'Teacher.fullname'));
  $this-set( 'te',$te);
  
 $this-set( 'st',$this-Tutorsession-Student-find('list', 
 array('fields' = array('Student.fullname') )));
  
 
 
 if (!$id) {
 throw new NotFoundException(__('Invalid post'));
 }

 $post = $this-Tutorsession-findById($id);
 if (!$post) {
 throw new NotFoundException(__('Invalid post'));
 }

 if ($this-request-is(array('post', 'put'))) {
 $this-Tutorsession-id = $id;
 if ($this-Tutorsession-save($this-request-data)) {
 $this-Tutorsession-setFlash(__('Your post has been updated.'));
 return $this-redirect(array('action' = 'displayall'));
 }
 $this-Session-setFlash(__('Unable to update your post.'));
 }

 if (!$this-request-data) {
 $this-request-data = $post;
 }
 }


 ///
 view edittutorsession

 ?php
 echo $this-Form-create('Tutorsession');
  echo $this-Form-input('teacher_id', array('options' = $te));
  echo $this-Form-input('student_id', array('options' = $st));

  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('Save Post');
 ?




  http://itfutures.edu.au?referer=email
 *P: (03) 9866 7737*
 *E: in...@itfutures.edu.au javascript:*
 *A: Suite 5 / Level 1 / 424 St Kilda Rd, Melbourne, 3004 
 https://www.google.com.au/url?sa=trct=jq=esrc=ssource=webcd=15cad=rjauact=8ved=0CKQBEPUXMA4url=http%3A%2F%2Fmaps.google.com.au%2Fmaps%3Fgl%3Dau%26hq%3Ditfutures%26daddr%3D1%2F424%2BSt%2BKilda%2BRd%2C%2BMelbourne%2BVIC%2B3004%26panel%3D1%26f%3Dd%26fb%3D1%26geocode%3DFdKovv0dMSWkCCnfp02hHWjWajGLbygrlMPvUw%26cid%3D6048267865728511883ei=hHUYU_abH8-okgXV7oGYDgusg=AFQjCNEBpgXrGRhNzMxOzPLHRVSQkdpXUQbvm=bv.62577051,d.dGI*


 *Connect with us: *

 http://plus.google.com/+itfutureseduau 
 http://linkedin.com/company/it-futures
   http://youtube.com/user/itfutureseduau  http://twitter.com/itfutures
   http://facebook.com/itfutures

 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: cant edit but can add row cakephp

2014-05-28 Thread jagguy
Hi

This fixed it as you said I mucked up the name.

 $this-Session-setFlash(

How can I say topic solved? 



-- 
 http://itfutures.edu.au?referer=email
*P: (03) 9866 7737*
*E: i...@itfutures.edu.au i...@itfutures.edu.au*
*A: Suite 5 / Level 1 / 424 St Kilda Rd, Melbourne, 3004 
https://www.google.com.au/url?sa=trct=jq=esrc=ssource=webcd=15cad=rjauact=8ved=0CKQBEPUXMA4url=http%3A%2F%2Fmaps.google.com.au%2Fmaps%3Fgl%3Dau%26hq%3Ditfutures%26daddr%3D1%2F424%2BSt%2BKilda%2BRd%2C%2BMelbourne%2BVIC%2B3004%26panel%3D1%26f%3Dd%26fb%3D1%26geocode%3DFdKovv0dMSWkCCnfp02hHWjWajGLbygrlMPvUw%26cid%3D6048267865728511883ei=hHUYU_abH8-okgXV7oGYDgusg=AFQjCNEBpgXrGRhNzMxOzPLHRVSQkdpXUQbvm=bv.62577051,d.dGI*


-- 
*Connect with us: *

http://plus.google.com/+itfutureseduau 
http://linkedin.com/company/it-futures
  http://youtube.com/user/itfutureseduau  http://twitter.com/itfutures 
http://facebook.com/itfutures

-- 


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.