PHP Fatal error: Call to a member function fetch_assoc()

Discussion in 'Developers' Forum' started by stefanmcds-mnt, Nov 12, 2014.

  1. Hi i'm develop a EPP Client module to mantain our domains i've created relative folder under interface/web and create epp_domains.tform.php
    Code:
    $form["title"]    = "EPP Domain";
    $form["description"]  = "";
    $form["name"]    = "epp_domains";
    $form["action"]   = "epp_domains_edit.php";
    $form["db_table"]  = "epp_domains";
    $form["db_table_idx"] = "id";
    $form["db_history"]  = "yes";
    $form["tab_default"] = "epp_domains";
    $form["list_default"] = "epp_domains_list.php";
    $form["auth"]   = 'yes'; // yes / no
    
    $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
    $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
    $form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
    $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
    $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
    
    $form["tabs"]['epp_domains'] = array (
    		'title'  => "Domains",
    		'width'  => 100,
    		'template'  => "templates/epp_domains_edit.htm",
    		'fields'  => array (
    				//#################################
    				// Begin Datatable fields
    				//#################################
    				'userID' => array (
    						'datatype' => 'INTEGER',
    						'formtype' => 'SELECT',
    						'default' => '',
    						'datasource' => array (  
    								'type' => 'SQL',
    								'querystring' => 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username',
    								'keyfield'=> 'userid',
    								'valuefield'=> 'username'
    						),
    						'value'  => '',
    						'width'  => '30',
    						'searchable' => 1
    				),
    				'status' => array (
    						'datatype' => 'TEXT',
    						'formtype' => 'TEXT',
    						'default' => '',
    						'value'  => '',
    						'width'  => '30',
    						'searchable' => 1
    				),
    				'domains' => array (
    						'datatype' => 'VARCHAR',
    						'formtype' => 'TEXT',
    						'filters'  => array( 
    								0 => array( 'event' => 'SAVE',
    											'type' => 'IDNTOASCII'),
    								1 => array( 'event' => 'SHOW',
    											'type' => 'IDNTOUTF8'),
    								2 => array( 'event' => 'SAVE',
    											'type' => 'TOLOWER')
    						),
    						'validators' => array (
    								0 => array ( 'type' => 'NOTEMPTY',
    											 'errmsg'=> 'domain_error_empty'),
    								1 => array ( 'type' => 'UNIQUE',
    											 'errmsg'=> 'domain_error_unique'),
    								2 => array ( 'type' => 'REGEX',
    											 'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/',
    											 'errmsg'=> 'domain_error_regex'),
    						),
    						'default' => '',
    						'value'  => '',
    						'width'  => '30',
    						'maxlength' => '255',
    						'searchable' => 1
    				),
    				'ns' => array (
    						'datatype' => 'TEXT',
    						'formtype' => 'TEXT',
    						'default' => '',
    						'datasource' => array (  
    								'type' => 'SQL',
    								'querystring' => "SELECT dnsprefix FROM epp_config WHERE {AUTHSQL}",
    								'keyfield'=> 'dnsprefix',
    								'valuefield'=> 'dnsprefix'
    						),
    						'value'  => '',
    						'width'  => '30',
    						'searchable' => 1
    				),
    				'registrant' => array (
    						'datatype' => 'VARCHAR',
    						'formtype' => 'TEXT',
    						'default' => '',
    						'datasource' => array (  
    								'type' => 'SQL',
    								'querystring' => "SELECT handle,name FROM epp_contacts WHERE userID='userID' AND entityType!='0' AND {AUTHSQL}",
    								'keyfield'=> 'handle',
    								'valuefield'=> 'name'
    						),
    						'value'  => '',
    						'width'  => '30',
    						'searchable' => 1
    				),
    				'admin' => array (
    						'datatype' => 'VARCHAR',
    						'formtype' => 'TEXT',
    						'default' => '',
    						'datasource' => array (  
    								'type' => 'SQL',
    								'querystring' => "SELECT handle,name FROM epp_contacts WHERE userID='userID' AND entityType='0' AND {AUTHSQL}",
    								'keyfield'=> 'handle',
    								'valuefield'=> 'name'
    						),
    						'value'  => '',
    						'width'  => '30',
    						'searchable' => 1
    				),
    				'tech' => array (
    						'datatype' => 'TEXT',
    						'formtype' => 'TEXT',
    						'default' => '',
    						'datasource' => array (  
    								'type' => 'SQL',
    								'querystring' => "SELECT techprefix FROM epp_config WHERE {AUTHSQL}",
    								'keyfield'=> 'techprefix',
    								'valuefield'=> 'techprefix'
    						),
    						'value'  => '',
    						'width'  => '30',
    						'searchable' => 0
    				),
    				'authinfo' => array (
    						'datatype' => 'VARCHAR',
    						'formtype' => 'TEXT',
    						'default' => '',
    						'value'  => '',
    						'width'  => '30',
    						'searchable' => 1
    				),
    				'crDATE' => array (
    						'datatype' => 'DATE',
    						'formtype' => 'TEXT',
    						'default' => '',
    						'value'  => '',
    						'width'  => '30',
    						'searchable' => 1
    				),
    				'exDate' => array (
    						'datatype' => 'DATE',
    						'formtype' => 'TEXT',
    						'default' => '',
    						'value'  => '',
    						'width'  => '30',
    						'searchable' => 1
    				),
    				'active' => array (
    						'datatype' => 'VARCHAR',
    						'formtype' => 'CHECKBOX',
    						'default' => 'y',
    						'value'  => array(0 => 'y', 1 => 'n')
    				),
    				//#################################
    				// ENDE Datatable fields
    				//#################################
    		)
    );
    
    
    ?>
    
    and epp_domains.edit.php

    Code:
    
    // Set the path to the form definition file.
    $tform_def_file = 'form/epp_domains.tform.php';
    
    // include the core configuration and application classes
    require_once('../../lib/config.inc.php');
    require_once('../../lib/app.inc.php');
    
    // Check the  module permissions and redirect if not allowed.
    if(!stristr($_SESSION['s']['user']['modules'],'eppclient')) {
    	header('Location: ../index.php');
    	die;
    }
    
    // Load the templating and form classes
    $app->uses('tpl,tform,tform_actions');
    $app->load('tform_actions');
    
    // Create a class page_action that extends the tform_actions base class
    class page_action extends tform_actions {
    
    	//* Customisations for the page actions will be defined here
    	//* Custom onSubmit Event handler
    	function onSubmit()
    	{
    		global $app, $conf;
    	
    		// If the current user is not the admin user
    		if($_SESSION['s']['user']['typ'] != 'admin') {
    			//* Set the admin as recipient
    			$this->dataRecord['id'] = 1;
    		}
    	
    		// Set the sender_id field to the ID of the current user
    		//$this->dataRecord['sender_id'] = $_SESSION['s']['user']['userid'];
    	
    		// call the onSubmit function of the parent class
    		parent::onSubmit();
    	}
    	
    	//* Custom onShow Event handler
    	function onShow()
    	{
    		global $app, $conf;
    	
    		// We do not want that messages get edited, so we switch to a
    		// read only template  if a existing message is loaded
    		if($this->id > 0) {
    			$app->tform->formDef['tabs']['message']['template'] = 'templates/epp_domains_list.htm';
    		}
    	
    		// call the onShow function of the parent class
    		parent::onShow();
    	}
    
    }
    
    // Create the new page object
    $page = new page_action();
    
    // Start the page rendering and action handling
    $page->onLoad();
    
    but when i click on New Domain from module_conf.php this return an php error

    PHP Fatal error: Call to a member function fetch_assoc() on a non-object in /var/www/ispconfig/interface/lib/classes/db_mysql.inc.php on line 234, referer: http://localhost/ispconfig/interface/web/index.php

    can you help me?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Which ispconfig version or git branch do you use?
     
  3. ver 3.0.5.4p5

    downloaded from master server, i've a multiserver configuration on my server farm such as
    - master server only ispconfig
    - web server
    - mail server
    - db server
     
  4. with git 3.1dev solved

    but with stable version?
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    I cant say why you get this problem in stable without debugging your system in detail as the forms that belong to stable are working fine and I dont have problems with third party modules that we develop like the billing module.
     

Share This Page