Skip to main content
Topic: Fatal error: Cannot redeclare SharedController::tb_tickets_option_list() in...  (Read 724 times) previous topic - next topic

Fatal error: Cannot redeclare SharedController::tb_tickets_option_list() in...

Hi everyone, I am brand new using PHPRAd which I just downloaded yesterday and started playing around with it to see whether is worth it buy the software.
Here is my first problem: I have a table (tickets) which picks data from other tables such as TicketStatus, Clients, etc. As I can see, PHPRad allows me to setup lookup data for one field, so when I try to set another field it shows up this error message: Fatal error: Cannot redeclare SharedController::tb_tickets_option_list() in F:\xampp\htdocs\mediabr\app\controllers\SharedController.php on line 48.
I checked the SharedController.php file and noticed that PHPRad "duplicated the the function tb_tickets_option_list(). Bellow you can see the code. What am I doing wrong? I need this ticket table to pick data from other tables to fill up some fields.
/**
     * tb_tickets_option_list Model Action
     * @return array
     */
   function tb_tickets_option_list(){
      $db = $this->GetModel();
      $sqltext = "SELECT  DISTINCT id AS value,_ClientName AS label FROM tb_clients ORDER BY _ClientName ASC";
      $queryparams = null;
      $arr = $db->rawQuery($sqltext, $queryparams);
      return $arr;
   }

   /**
     * tb_tickets_option_list Model Action
     * @return array
     */
   function tb_tickets_option_list(){
      $db = $this->GetModel();
      $sqltext = "SELECT  DISTINCT Status AS value,Status AS label FROM ticket_status ORDER BY Status ASC";
      $queryparams = null;
      $arr = $db->rawQuery($sqltext, $queryparams);
      return $arr;
   }

Re: Fatal error: Cannot redeclare SharedController::tb_tickets_option_list() in...

Reply #1
@jufau‍ please share screenshots of the configurations u did that caused the error.

Re: Fatal error: Cannot redeclare SharedController::tb_tickets_option_list() in...

Reply #2
Hi, I don't really thing the screenshots will help much but there they go.
Apparently the software does not let me create more than one relationship for the same page. The first one works fine. But if i try to create a second one it returns the error mentioned above.
I have several fields on my tickets table that are related to other tables such as ticket_status, ticket_type, etc. So instead of showing the status id, I want it to show the status description from the status_description field on the ticket_status table. The same for all other fields/tables. Maybe I am not doing things the right way.

Re: Fatal error: Cannot redeclare SharedController::tb_tickets_option_list() in...

Reply #3
@jufau‍ please send me a private message containing your Teamviewer id, so that you can explain to me better on TeamViewer.