php - Can not retrieve multiple records from the database in CakePHP -


i working 2.6.1 version of cakephp. have created 1 controller named androidcontroller.php , looks like

<?php class androidcontroller extends appcontroller {  public function survey_question() {     configure::write('debug', '2');     $survey_id = $_request['survey_id'];     $this->layout = "";     //$condition = "question.survey_id = '".$survey_id."'";     $info = $this->question->find('all', array(         'conditions' => array(                     "question.survey_id" => $survey_id  /*dont use array() */             )         ));     echo json_encode($info);     exit; } } ?> 

so, gives error

error: action admin_survey_question not defined in controller androidcontroller

error:create androidcontroller::admin_survey_question() in file: app/controller/androidcontroller.php.

note :my website url http://navyon.com/dev/mt/admin/android/survey_question?survey_id=2

so how can resolve this?

you have enable admin routing action action should preceded admin_ action below:

<?php class androidcontroller extends appcontroller {  public function admin_survey_question()  { configure::write('debug', '2'); $survey_id = $_request['survey_id']; $this->layout = ""; //$condition = "question.survey_id = '".$survey_id."'"; $info = $this->question->find('all', array(     'conditions' => array(                 "question.survey_id" => $survey_id  /*dont use array()      */         )     )); echo json_encode($info); exit;  } } ?> 

if don't want enable admin routing action remove admin url , access :

http://navyon.com/dev/mt/android/survey_question?survey_id=2 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -