neginf Posted June 17, 2013 Share Posted June 17, 2013 Very new to PHP. A query made with the find() function has a syntax error - a column name is outside the backwards quotes. LEFT JOIN `lyn` AS `DiscontinueMed` ON (`Enr`.`` discontinue_med = `DiscontinueMed`.`id`) There are other similar alias lyn with left joins to ENR that look ok and don't cause errors The code that makes the query is function eventFormCreation($model, $fields, $currentPersonId, $limit='50'){ //the only reason we have limit set is because the Upload Additional Information can have more // than 1 without being wrong. Where we need to se the problem with other forms $record = $this->$model->find('all', array( 'conditions' => array($model.'.person_id' => $currentPersonId),// 'fields' => $fields,// 'recursive' => -1, 'limit'=>$limit)); //pass the field to be included in the search $isComplete = $this->isComplete($model, $fields, $record); etc 1. What can cause this ? 2. What can fix it ? 3. Can a query be run in CakePHP without the find() function - writing the query out explicitly and avoiding find() ? Quote Link to comment https://forums.phpfreaks.com/topic/279266-syntax-error-in-query/ Share on other sites More sharing options...
neginf Posted June 17, 2013 Author Share Posted June 17, 2013 The CakePHP version is 1.3.16, the project is written in version 1.3. something, and the MySQL is version 5.6. Quote Link to comment https://forums.phpfreaks.com/topic/279266-syntax-error-in-query/#findComment-1436456 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.