Jump to content

syntax error in query


neginf

Recommended Posts

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() ?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.